Linux tabs restore

This commit is contained in:
2022-02-04 01:07:55 +01:00
parent 2e43cca9fd
commit f9c675eb7c
5 changed files with 15 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ namespace FileTime.Core.Components
i.FullName == null && value?.FullName == null
? i.Name == value?.Name
: i.FullName == value?.FullName);
if (itemToSelect == null) throw new IndexOutOfRangeException("Provided item does not exists in the current container.");
if (itemToSelect == null) throw new IndexOutOfRangeException($"Provided item ({value.FullName ?? "unknwon"}) does not exists in the current container ({_currentLocation.FullName ?? "unknwon"}).");
}
CancellationToken newToken;

View File

@@ -48,7 +48,14 @@ namespace FileTime.Avalonia.Application
{
if (value != null)
{
SetSelectedItemAsync(value, true).Wait();
try
{
SetSelectedItemAsync(value, true).Wait();
}
catch
{
//TODO: Debug, linux start after restore 3 tabs
}
}
}
}

View File

@@ -58,7 +58,7 @@ namespace FileTime.Avalonia.Services
catch { }
}
public void SaveStatesAsync()
public void SaveStates()
{
var state = new PersistenceRoot
{

View File

@@ -114,7 +114,7 @@ namespace FileTime.Avalonia.Views
{
try
{
ViewModel?.StatePersistence.SaveStatesAsync();
ViewModel?.StatePersistence.SaveStates();
}
catch { }
}

View File

@@ -85,7 +85,10 @@ namespace FileTime.Providers.Local
public bool CanHandlePath(string path)
{
var normalizedPath = NormalizePath(path);
return _rootContainers.Any(r => normalizedPath.StartsWith(NormalizePath(r.Name)));
Func<IContainer, bool> match = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? c => normalizedPath.StartsWith(NormalizePath(c.Name))
: c => normalizedPath.StartsWith(NormalizePath("/" + c.Name));
return _rootContainers.Any(match);
}
public void SetParent(IContainer container) => _parent = container;