Fix keys file overwrite on installation and method name typo (ryubing/ryujinx!268)

See merge request ryubing/ryujinx!268
This commit is contained in:
BowedCascade 2026-03-14 13:52:58 -05:00 committed by LotP
parent 6f90e47a73
commit 5ae86fc493
2 changed files with 10 additions and 11 deletions

View File

@ -488,6 +488,8 @@ namespace Ryujinx.HLE.FileSystem
if (keyPaths.Length is 0) if (keyPaths.Length is 0)
throw new FileNotFoundException($"Directory '{keysSource}' contained no '.keys' files."); throw new FileNotFoundException($"Directory '{keysSource}' contained no '.keys' files.");
List<string> failedFiles = new();
foreach (string filePath in keyPaths) foreach (string filePath in keyPaths)
{ {
try try
@ -497,17 +499,20 @@ namespace Ryujinx.HLE.FileSystem
catch (Exception e) catch (Exception e)
{ {
Logger.Error?.Print(LogClass.Application, e.Message); Logger.Error?.Print(LogClass.Application, e.Message);
failedFiles.Add(Path.GetFileName(filePath));
continue; continue;
} }
string destPath = Path.Combine(installDirectory, Path.GetFileName(filePath)); string destPath = Path.Combine(installDirectory, Path.GetFileName(filePath));
if (File.Exists(destPath))
File.Delete(destPath);
File.Copy(filePath, destPath, true); File.Copy(filePath, destPath, true);
} }
if (failedFiles.Count > 0)
{
throw new InvalidOperationException($"Failed to install the following key files: {string.Join(", ", failedFiles)}");
}
return; return;
} }
@ -518,8 +523,6 @@ namespace Ryujinx.HLE.FileSystem
FileInfo info = new(keysSource); FileInfo info = new(keysSource);
using FileStream file = File.OpenRead(keysSource);
if (info.Extension is not ".keys") if (info.Extension is not ".keys")
throw new InvalidFirmwarePackageException("Input file extension is not .keys"); throw new InvalidFirmwarePackageException("Input file extension is not .keys");
@ -534,10 +537,6 @@ namespace Ryujinx.HLE.FileSystem
string dest = Path.Combine(installDirectory, info.Name); string dest = Path.Combine(installDirectory, info.Name);
if (File.Exists(dest))
File.Delete(dest);
// overwrite: true seems to not work on its own? https://github.com/Ryubing/Issues/issues/189
File.Copy(keysSource, dest, true); File.Copy(keysSource, dest, true);
} }
@ -1059,7 +1058,7 @@ namespace Ryujinx.HLE.FileSystem
} }
} }
public static bool AreKeysAlredyPresent(string pathToCheck) public static bool AreKeysAlreadyPresent(string pathToCheck)
{ {
string[] fileNames = ["prod.keys", "title.keys", "console.keys", "dev.keys"]; string[] fileNames = ["prod.keys", "title.keys", "console.keys", "dev.keys"];
foreach (string file in fileNames) foreach (string file in fileNames)

View File

@ -1062,7 +1062,7 @@ namespace Ryujinx.Ava.UI.ViewModels
string dialogMessage = string dialogMessage =
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogKeysInstallerKeysInstallMessage); LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.DialogKeysInstallerKeysInstallMessage);
if (ContentManager.AreKeysAlredyPresent(systemDirectory)) if (ContentManager.AreKeysAlreadyPresent(systemDirectory))
{ {
dialogMessage += dialogMessage +=
LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys