Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fixed an issue with opening screen saver files #13573

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
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
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)
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
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