Skip to content

Commit

Permalink
Fix: Fixed an issue with opening screen saver files (#13573)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 authored Oct 25, 2023
1 parent d8eb476 commit 34bc7bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Files.App/Helpers/Navigation/NavigationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static async Task<bool> OpenPath(string path, IShellPage associatedInstan
bool isDirectory = NativeFileOperationsHelper.HasFileAttribute(path, System.IO.FileAttributes.Directory);
bool isReparsePoint = NativeFileOperationsHelper.HasFileAttribute(path, System.IO.FileAttributes.ReparsePoint);
bool isShortcut = FileExtensionHelpers.IsShortcutOrUrlFile(path);
bool isScreenSaver = FileExtensionHelpers.IsScreenSaverFile(path);
bool isTag = path.StartsWith("tag:");
FilesystemResult opened = (FilesystemResult)false;

Expand Down Expand Up @@ -200,6 +201,10 @@ public static async Task<bool> OpenPath(string path, IShellPage associatedInstan
break;

case FilesystemItemType.File:
// Starts the screensaver in full-screen mode
if (isScreenSaver)
args += "/s";

opened = await OpenFile(path, associatedInstance, shortcutInfo, openViaApplicationPicker, args);
break;
};
Expand Down Expand Up @@ -442,4 +447,4 @@ private static async Task OpenPathAsync(bool forceOpenInNewTab, bool openFolderI
}
}
}
}
}
11 changes: 11 additions & 0 deletions src/Files.Shared/Helpers/FileExtensionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ public static bool IsVhdFile(string? fileExtensionToCheck)
{
return HasExtension(fileExtensionToCheck, ".vhd", ".vhdx");
}

/// <summary>
/// Check if the file extension is a screen saver file.
/// </summary>
/// <param name="fileExtensionToCheck">The file extension to check.</param>
/// <returns><c>true</c> if the fileExtensionToCheck is a screen saver file; otherwise, <c>false</c>.</returns>
/// <remarks>Screen saver file types are; scr</remarks>
public static bool IsScreenSaverFile(string? fileExtensionToCheck)
{
return HasExtension(fileExtensionToCheck, ".scr");
}

/// <summary>
/// Check if the file extension is a media (audio/video) file.
Expand Down

0 comments on commit 34bc7bb

Please sign in to comment.