Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@
{
if (!UserSettingsService.LayoutSettingsService.SyncFolderPreferencesAcrossDirectories)
{
if (!IsPathAccessible(path))
return GetDefaultLayoutPreferences(path);

path = path.TrimPath() ?? string.Empty;

return SafetyExtensions.IgnoreExceptions(() =>
Expand Down Expand Up @@ -563,6 +566,18 @@
}
}

private static bool IsPathAccessible(string path)
{
try
{
return !string.IsNullOrEmpty(path) && Directory.Exists(path);

Check failure on line 573 in src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs

View workflow job for this annotation

GitHub Actions / build (Debug, arm64)

The name 'Directory' does not exist in the current context

Check failure on line 573 in src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs

View workflow job for this annotation

GitHub Actions / build (Debug, x64)

The name 'Directory' does not exist in the current context

Check failure on line 573 in src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs

View workflow job for this annotation

GitHub Actions / build (Release, arm64)

The name 'Directory' does not exist in the current context

Check failure on line 573 in src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs

View workflow job for this annotation

GitHub Actions / build (Release, x64)

The name 'Directory' does not exist in the current context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also paths that indicate the home page or tag search results, but this code ignores them and is inappropriate.

}
catch (Exception)
{
return false;
}
}

private static bool SetLayoutPreferencesToDatabase(string path, ulong? frn, LayoutPreferencesItem preferencesItem)
{
if (string.IsNullOrEmpty(path))
Expand Down
Loading