summaryrefslogtreecommitdiffstats
path: root/src/launcher/runner.rs
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2025-01-21 16:36:33 -0600
committerLibravatar bigfoot547 <[email protected]>2025-01-21 17:07:07 -0600
commita11b8764f1be5124b5a81a39809cfeb520f4a96d (patch)
tree7465f8c1c4913bcb668b66eb5f8230cee59211e1 /src/launcher/runner.rs
parentrandom small changes (diff)
strip verbatim prefix \\?\ from paths on windows
without this, java freaks out (amended to remove an artifact, arguments.txt)
Diffstat (limited to 'src/launcher/runner.rs')
-rw-r--r--src/launcher/runner.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/launcher/runner.rs b/src/launcher/runner.rs
index 0f65b49..41b3ed1 100644
--- a/src/launcher/runner.rs
+++ b/src/launcher/runner.rs
@@ -2,6 +2,7 @@ use std::borrow::Cow;
use std::ffi::{OsStr, OsString};
use std::iter;
use std::process::Command;
+use crate::util::AsJavaPath;
use crate::version::{CompleteVersion, FeatureMatcher, OperatingSystem};
use super::rules::CompatCheck;
use super::strsub::{self, SubFunc};
@@ -14,7 +15,7 @@ impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
fn substitute(&self, key: &str) -> Option<Cow<'rep, str>> {
match key {
"assets_index_name" => self.0.asset_index_name.as_ref().map(|s| Cow::Borrowed(s.as_str())),
- "assets_root" => Some(self.0.launcher.assets.get_home().to_string_lossy()),
+ "assets_root" => Some(self.0.launcher.assets.get_home().as_java_path().to_string_lossy()),
"auth_access_token" => Some(Cow::Borrowed("-")), // TODO
"auth_player_name" => Some(Cow::Borrowed("Player")), // TODO
"auth_session" => Some(Cow::Borrowed("-")), // TODO
@@ -22,14 +23,15 @@ impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
"auth_xuid" => Some(Cow::Borrowed("00000000-0000-0000-0000-000000000000")), // TODO
"classpath" => Some(Cow::Borrowed(self.0.classpath.as_str())), // TODO
"classpath_separator" => None, // FIXME
- "game_assets" => self.0.virtual_assets_path.as_ref().map(|s| s.to_string_lossy()),
- "game_directory" => Some(self.0.instance_home.to_string_lossy()),
+ "game_assets" => self.0.virtual_assets_path.as_ref()
+ .map(|s| s.as_path().as_java_path().to_string_lossy()),
+ "game_directory" => Some(self.0.instance_home.as_java_path().to_string_lossy()),
"language" => Some(Cow::Borrowed("en-us")), // ???
"launcher_name" => Some(Cow::Borrowed("ozone (olauncher 3)")), // TODO
"launcher_version" => Some(Cow::Borrowed("yeah")), // TODO
- "library_directory" => Some(self.0.launcher.libraries.home.to_string_lossy()),
- "natives_directory" => Some(self.0.natives_path.to_string_lossy()),
- "primary_jar" => self.0.client_jar.as_ref().map(|p| p.to_string_lossy()),
+ "library_directory" => Some(self.0.launcher.libraries.home.as_java_path().to_string_lossy()),
+ "natives_directory" => Some(self.0.natives_path.as_java_path().to_string_lossy()),
+ "primary_jar" => self.0.client_jar.as_ref().map(|p| p.as_path().as_java_path().to_string_lossy()),
"quickPlayMultiplayer" => None, // TODO
"quickPlayPath" => None, // TODO
"quickPlayRealms" => None, // TODO
@@ -45,7 +47,7 @@ impl<'rep, 'l, F: FeatureMatcher> SubFunc<'rep> for LaunchArgSub<'rep, 'l, F> {
if let Some(asset_key) = key.strip_prefix("asset=") {
return self.0.asset_index.as_ref()
.map_or(None, |idx| idx.objects.get(asset_key))
- .map(|obj| Cow::Owned(self.0.launcher.assets.get_object_path(obj).to_string_lossy().into_owned()))
+ .map(|obj| Cow::Owned(self.0.launcher.assets.get_object_path(obj).as_java_path().to_string_lossy().into_owned()))
}
None
@@ -116,7 +118,7 @@ pub fn run_the_game(launch: &Launch) -> Result<(), Box<dyn std::error::Error>> {
.map(|o| o.as_os_str())
.chain(iter::once(OsStr::new(launch.main_class.as_str())))
.chain(launch.game_args.iter().map(|o| o.as_os_str())))
- .current_dir(launch.instance_path.as_path()).spawn()?.wait()?;
+ .current_dir(launch.instance_path.as_path().as_java_path()).spawn()?.wait()?;
Ok(())
}