diff --git a/Program.cs b/Program.cs index 0777028..ca81910 100644 --- a/Program.cs +++ b/Program.cs @@ -324,8 +324,14 @@ public static void Main(string[] args) // ppy|osu|latest stands for https://github.com/ppy/osu and get the latest release // osu.AppImage.zsync is AppImage update information file, that is generated by the tool // more information there https://docs.appimage.org/packaging-guide/optional/updates.html?highlight=update#using-appimagetool + // also sets a VERSION environment variable that creates a X-AppImage-Version key in the .desktop file inside the AppImage + // for information about this key: https://docs.appimage.org/reference/desktop-integration.html#custom-keys-introduced-for-appimage-purposes runCommand(appImageToolPath, - $"\"{stagingTarget}\" -u \"gh-releases-zsync|ppy|osu|latest|osu.AppImage.zsync\" \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\" --sign", false); + $"\"{stagingTarget}\" -u \"gh-releases-zsync|ppy|osu|latest|osu.AppImage.zsync\" \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\" --sign", false, + new Dictionary + { + ["VERSION"] = version + }); // mark finally the osu! AppImage as executable -> Don't compress it. runCommand("chmod", $"+x \"{Path.Combine(Environment.CurrentDirectory, "releases")}/osu.AppImage\""); @@ -620,7 +626,7 @@ private static void findSolutionPath() solutionPath = path; } - private static bool runCommand(string command, string args, bool useSolutionPath = true) + private static bool runCommand(string command, string args, bool useSolutionPath = true, Dictionary? environmentVariables = null) { write($"Running {command} {args}..."); @@ -634,6 +640,12 @@ private static bool runCommand(string command, string args, bool useSolutionPath WindowStyle = ProcessWindowStyle.Hidden }; + if (environmentVariables != null) + { + foreach (var pair in environmentVariables) + psi.EnvironmentVariables.Add(pair.Key, pair.Value); + } + Process? p = Process.Start(psi); if (p == null) return false;