From 476076b684ebee250c4582497ed64ed552d28d48 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Tue, 24 Oct 2023 16:38:54 -0400 Subject: [PATCH 1/2] Fix: Fixed an issue with opening screen saver files --- src/Files.App/Helpers/Navigation/NavigationHelpers.cs | 5 +++++ src/Files.Shared/Helpers/FileExtensionHelpers.cs | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs index c004026e3cf6..fd32cc006561 100644 --- a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs +++ b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs @@ -121,6 +121,7 @@ public static async Task 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; @@ -200,6 +201,10 @@ public static async Task OpenPath(string path, IShellPage associatedInstan break; case FilesystemItemType.File: + // Starts the screensaver in full-screen mode + if (isScreenSaver) + args = args + "/s"; + opened = await OpenFile(path, associatedInstance, shortcutInfo, openViaApplicationPicker, args); break; }; diff --git a/src/Files.Shared/Helpers/FileExtensionHelpers.cs b/src/Files.Shared/Helpers/FileExtensionHelpers.cs index 58b100fb4145..d73394530f94 100644 --- a/src/Files.Shared/Helpers/FileExtensionHelpers.cs +++ b/src/Files.Shared/Helpers/FileExtensionHelpers.cs @@ -153,6 +153,17 @@ public static bool IsVhdFile(string? fileExtensionToCheck) { return HasExtension(fileExtensionToCheck, ".vhd", ".vhdx"); } + + /// + /// Check if the file extension is a screen saver file. + /// + /// The file extension to check. + /// true if the fileExtensionToCheck is a screen saver file; otherwise, false. + /// Screen saver file types are; scr + public static bool IsScreenSaverFile(string? fileExtensionToCheck) + { + return HasExtension(fileExtensionToCheck, ".scr"); + } /// /// Check if the file extension is a media (audio/video) file. From b33864d1d13240d5eff15d0eed2239207c38ebea Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:18:30 -0400 Subject: [PATCH 2/2] Update NavigationHelpers.cs --- src/Files.App/Helpers/Navigation/NavigationHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs index fd32cc006561..d6cb86a7e012 100644 --- a/src/Files.App/Helpers/Navigation/NavigationHelpers.cs +++ b/src/Files.App/Helpers/Navigation/NavigationHelpers.cs @@ -203,7 +203,7 @@ public static async Task OpenPath(string path, IShellPage associatedInstan case FilesystemItemType.File: // Starts the screensaver in full-screen mode if (isScreenSaver) - args = args + "/s"; + args += "/s"; opened = await OpenFile(path, associatedInstance, shortcutInfo, openViaApplicationPicker, args); break; @@ -447,4 +447,4 @@ private static async Task OpenPathAsync(bool forceOpenInNewTab, bool openFolderI } } } -} \ No newline at end of file +}