Skip to content

Commit 34bc7bb

Browse files
authored
Fix: Fixed an issue with opening screen saver files (#13573)
1 parent d8eb476 commit 34bc7bb

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Files.App/Helpers/Navigation/NavigationHelpers.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public static async Task<bool> OpenPath(string path, IShellPage associatedInstan
121121
bool isDirectory = NativeFileOperationsHelper.HasFileAttribute(path, System.IO.FileAttributes.Directory);
122122
bool isReparsePoint = NativeFileOperationsHelper.HasFileAttribute(path, System.IO.FileAttributes.ReparsePoint);
123123
bool isShortcut = FileExtensionHelpers.IsShortcutOrUrlFile(path);
124+
bool isScreenSaver = FileExtensionHelpers.IsScreenSaverFile(path);
124125
bool isTag = path.StartsWith("tag:");
125126
FilesystemResult opened = (FilesystemResult)false;
126127

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

202203
case FilesystemItemType.File:
204+
// Starts the screensaver in full-screen mode
205+
if (isScreenSaver)
206+
args += "/s";
207+
203208
opened = await OpenFile(path, associatedInstance, shortcutInfo, openViaApplicationPicker, args);
204209
break;
205210
};
@@ -442,4 +447,4 @@ private static async Task OpenPathAsync(bool forceOpenInNewTab, bool openFolderI
442447
}
443448
}
444449
}
445-
}
450+
}

src/Files.Shared/Helpers/FileExtensionHelpers.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ public static bool IsVhdFile(string? fileExtensionToCheck)
153153
{
154154
return HasExtension(fileExtensionToCheck, ".vhd", ".vhdx");
155155
}
156+
157+
/// <summary>
158+
/// Check if the file extension is a screen saver file.
159+
/// </summary>
160+
/// <param name="fileExtensionToCheck">The file extension to check.</param>
161+
/// <returns><c>true</c> if the fileExtensionToCheck is a screen saver file; otherwise, <c>false</c>.</returns>
162+
/// <remarks>Screen saver file types are; scr</remarks>
163+
public static bool IsScreenSaverFile(string? fileExtensionToCheck)
164+
{
165+
return HasExtension(fileExtensionToCheck, ".scr");
166+
}
156167

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

0 commit comments

Comments
 (0)