From 5e439ee8d5f80233d1b2753fad745a41d0681222 Mon Sep 17 00:00:00 2001 From: Timerix Date: Mon, 7 Apr 2025 06:18:22 +0500 Subject: [PATCH] fixes for linux --- Mlaumcherb.Client.Avalonia/GameVersion.cs | 10 ++++++---- .../классы/Буржуазия/JavaVersionCatalog.cs | 6 +++--- Mlaumcherb.Client.Avalonia/холопы/PathHelper.cs | 11 +++++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Mlaumcherb.Client.Avalonia/GameVersion.cs b/Mlaumcherb.Client.Avalonia/GameVersion.cs index d3952e1..c6ec5cc 100644 --- a/Mlaumcherb.Client.Avalonia/GameVersion.cs +++ b/Mlaumcherb.Client.Avalonia/GameVersion.cs @@ -34,7 +34,8 @@ public class GameVersion _gameArgs = new GameArguments(_descriptor); _libraries = new Libraries(_descriptor); WorkingDirectory = GetVersionDir(_descriptor.id); - JavaExecutableFilePath = GetJavaExecutablePath(_descriptor.javaVersion.component, LauncherApp.Config.debug); + JavaExecutableFilePath = GetJavaExecutablePath( + _descriptor.javaVersion.component, LauncherApp.Config.redirect_game_output); } public async Task Download(bool update, Action networkTaskCreatedCallback) @@ -108,6 +109,7 @@ public class GameVersion if (string.IsNullOrWhiteSpace(LauncherApp.Config.player_name)) throw new Exception("invalid player name"); + string classSeparator = PlatformHelper.GetOs() == "windows" ? ";" : ":"; Directory.Create(WorkingDirectory); string uuid = GetPlayerUUID(LauncherApp.Config.player_name); Dictionary placeholder_values = new() { @@ -127,14 +129,14 @@ public class GameVersion { "launcher_version", "1.6.84-j" }, { "classpath", _libraries.Libs.Select(l => l.jarFilePath) .Append(GetVersionJarFilePath(_descriptor.id)) - .MergeToString(';') }, + .MergeToString(classSeparator) }, { "assets_index_name", _descriptor.assets }, { "assets_root", GetAssetsDir().ToString() }, { "game_assets", GetAssetsDir().ToString() }, { "game_directory", WorkingDirectory.ToString() }, { "natives_directory", GetNativeLibrariesDir(_descriptor.id).ToString() }, { "library_directory", GetLibrariesDir().ToString() }, - { "classpath_separator", ";"}, + { "classpath_separator", classSeparator}, { "path", GetLog4jConfigFilePath().ToString() }, { "version_name", _descriptor.id }, { "version_type", _descriptor.type }, @@ -186,4 +188,4 @@ public class GameVersion public override string ToString() => Id; -} \ No newline at end of file +} diff --git a/Mlaumcherb.Client.Avalonia/классы/Буржуазия/JavaVersionCatalog.cs b/Mlaumcherb.Client.Avalonia/классы/Буржуазия/JavaVersionCatalog.cs index 86318a5..ec584cf 100644 --- a/Mlaumcherb.Client.Avalonia/классы/Буржуазия/JavaVersionCatalog.cs +++ b/Mlaumcherb.Client.Avalonia/классы/Буржуазия/JavaVersionCatalog.cs @@ -5,9 +5,9 @@ namespace Mlaumcherb.Client.Avalonia.классы; public class JavaVersionCatalog { - [JsonProperty("linux")] + [JsonProperty("linux-i386")] public Dictionary? linux_x86 { get; set; } - [JsonProperty("linux-i386")] + [JsonProperty("linux")] public Dictionary? linux_x64 { get; set; } [JsonProperty("mac-os")] public Dictionary? osx_x64 { get; set; } @@ -82,4 +82,4 @@ public class JavaCompressedArtifact { public Artifact? lzma { get; set; } [JsonRequired] public Artifact raw { get; set; } = null!; -} \ No newline at end of file +} diff --git a/Mlaumcherb.Client.Avalonia/холопы/PathHelper.cs b/Mlaumcherb.Client.Avalonia/холопы/PathHelper.cs index 10f70ec..a028fe9 100644 --- a/Mlaumcherb.Client.Avalonia/холопы/PathHelper.cs +++ b/Mlaumcherb.Client.Avalonia/холопы/PathHelper.cs @@ -40,14 +40,17 @@ public static class PathHelper public static IOPath GetJavaBinDir(string id) => Path.Concat(GetJavaRuntimeDir(id), "bin"); - public static IOPath GetJavaExecutablePath(string id, bool debug) + public static IOPath GetJavaExecutablePath(string id, bool redirectOutput) { string executable_name = "java"; - if (debug) - executable_name += "w"; + if (!redirectOutput) + executable_name = "javaw"; if(OperatingSystem.IsWindows()) executable_name += ".exe"; - return Path.Concat(GetJavaBinDir(id), executable_name); + var path = Path.Concat(GetJavaBinDir(id), executable_name); + if(!redirectOutput && !File.Exists(path)) + return GetJavaExecutablePath(id, true); + return path; } public static string GetLog4jConfigFileName() => "log4j.xml";