mirror of
				https://github.com/ryujinx-mirror/ryujinx.git
				synced 2025-11-04 08:18:58 -06:00 
			
		
		
		
	infra: Fix updater for old Ava users (#6441)
* Add binaries with both names to release archives * Add migration code for the new filename * Add Ryujinx.Ava to all win/linux releases for a while
This commit is contained in:
		@@ -298,7 +298,14 @@ namespace Ryujinx.Modules
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        // Find the process name.
 | 
			
		||||
                        string ryuName = Path.GetFileName(Environment.ProcessPath);
 | 
			
		||||
                        string ryuName = Path.GetFileName(Environment.ProcessPath) ?? string.Empty;
 | 
			
		||||
 | 
			
		||||
                        // Migration: Start the updated binary.
 | 
			
		||||
                        // TODO: Remove this in a future update.
 | 
			
		||||
                        if (ryuName.StartsWith("Ryujinx.Ava"))
 | 
			
		||||
                        {
 | 
			
		||||
                            ryuName = ryuName.Replace(".Ava", "");
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // Some operating systems can see the renamed executable, so strip off the .ryuold if found.
 | 
			
		||||
                        if (ryuName.EndsWith(".ryuold"))
 | 
			
		||||
@@ -307,7 +314,7 @@ namespace Ryujinx.Modules
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // Fallback if the executable could not be found.
 | 
			
		||||
                        if (!Path.Exists(Path.Combine(executableDirectory, ryuName)))
 | 
			
		||||
                        if (ryuName.Length == 0 || !Path.Exists(Path.Combine(executableDirectory, ryuName)))
 | 
			
		||||
                        {
 | 
			
		||||
                            ryuName = OperatingSystem.IsWindows() ? "Ryujinx.exe" : "Ryujinx";
 | 
			
		||||
                        }
 | 
			
		||||
@@ -759,6 +766,43 @@ namespace Ryujinx.Modules
 | 
			
		||||
            {
 | 
			
		||||
                File.Delete(file);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Migration: Delete old Ryujinx binary.
 | 
			
		||||
            // TODO: Remove this in a future update.
 | 
			
		||||
            if (!OperatingSystem.IsMacOS())
 | 
			
		||||
            {
 | 
			
		||||
                string[] oldRyuFiles = Directory.GetFiles(_homeDir, "Ryujinx.Ava*", SearchOption.TopDirectoryOnly);
 | 
			
		||||
                // Assume we are running the new one if the process path is not available.
 | 
			
		||||
                // This helps to prevent an infinite loop of restarts.
 | 
			
		||||
                string currentRyuName = Path.GetFileName(Environment.ProcessPath) ?? (OperatingSystem.IsWindows() ? "Ryujinx.exe" : "Ryujinx");
 | 
			
		||||
 | 
			
		||||
                string newRyuName = Path.Combine(_homeDir, currentRyuName.Replace(".Ava", ""));
 | 
			
		||||
                if (!currentRyuName.Contains("Ryujinx.Ava"))
 | 
			
		||||
                {
 | 
			
		||||
                    foreach (string oldRyuFile in oldRyuFiles)
 | 
			
		||||
                    {
 | 
			
		||||
                        File.Delete(oldRyuFile);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                // Should we be running the old binary, start the new one if possible.
 | 
			
		||||
                else if (File.Exists(newRyuName))
 | 
			
		||||
                {
 | 
			
		||||
                    ProcessStartInfo processStart = new(newRyuName)
 | 
			
		||||
                    {
 | 
			
		||||
                        UseShellExecute = true,
 | 
			
		||||
                        WorkingDirectory = _homeDir,
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    foreach (string argument in CommandLineState.Arguments)
 | 
			
		||||
                    {
 | 
			
		||||
                        processStart.ArgumentList.Add(argument);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Process.Start(processStart);
 | 
			
		||||
 | 
			
		||||
                    Environment.Exit(0);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user