fixes for linux

This commit is contained in:
Timerix 2025-04-07 06:18:22 +05:00
parent cbfd5f8da8
commit 5e439ee8d5
3 changed files with 16 additions and 11 deletions

View File

@ -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<NetworkTask> 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<string, string> 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 },

View File

@ -5,9 +5,9 @@ namespace Mlaumcherb.Client.Avalonia.классы;
public class JavaVersionCatalog
{
[JsonProperty("linux")]
public Dictionary<string, JavaVersionProps[]>? linux_x86 { get; set; }
[JsonProperty("linux-i386")]
public Dictionary<string, JavaVersionProps[]>? linux_x86 { get; set; }
[JsonProperty("linux")]
public Dictionary<string, JavaVersionProps[]>? linux_x64 { get; set; }
[JsonProperty("mac-os")]
public Dictionary<string, JavaVersionProps[]>? osx_x64 { get; set; }

View File

@ -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";