Skip to content

Commit

Permalink
fix steam dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Dec 18, 2023
1 parent b472a1c commit 1fb6a29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rust-embed = "8.1.0"
semver = "1.0.20"
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
steamlocate = "2.0.0-alpha.0"
steamlocate = "2.0.0-beta.1"
term-table = "1.3.2"
time = { version = "0.3.30", features = ["formatting"] }
tracing = { workspace = true }
Expand Down
17 changes: 8 additions & 9 deletions bin/src/commands/launch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,13 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {

trace!("launch config: {:?}", launch);

let Some(arma3dir) =
SteamDir::locate().and_then(|mut s| s.app(&107_410).map(std::borrow::ToOwned::to_owned))
else {
let Ok(Some((arma3app, library))) = SteamDir::locate().and_then(|s| s.find_app(107_410)) else {
report.error(ArmaNotFound::code());
return Ok(report);
};
let arma3dir = library.resolve_app_dir(&arma3app);

debug!("Arma 3 found at: {}", arma3dir.path.display());
debug!("Arma 3 found at: {}", arma3dir.display());

let mut mods = Vec::new();

Expand Down Expand Up @@ -153,7 +152,7 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {

// climb to the workshop folder
if !workshop.is_empty() {
let Some(common) = arma3dir.path.parent() else {
let Some(common) = arma3dir.parent() else {
report.error(WorkshopNotFound::code());
return Ok(report);
};
Expand Down Expand Up @@ -193,7 +192,7 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {

report.merge(executor.run()?);

let prefix_folder = arma3dir.path.join(mainprefix);
let prefix_folder = arma3dir.join(mainprefix);
if !prefix_folder.exists() {
std::fs::create_dir_all(&prefix_folder)?;
}
Expand Down Expand Up @@ -231,11 +230,11 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {
if cfg!(target_os = "windows") {
info!(
"Launching {:?} with:\n {}",
arma3dir.path.display(),
arma3dir.display(),
args.join("\n ")
);
std::process::Command::new({
let mut path = arma3dir.path;
let mut path = arma3dir;
if let Some(exe) = matches.get_one::<String>("executable") {
let exe = PathBuf::from(exe);
if exe.is_absolute() {
Expand All @@ -254,7 +253,7 @@ pub fn execute(matches: &ArgMatches) -> Result<Report, Error> {
.args(args)
.spawn()?;
} else {
linux_launch(&arma3dir.path, &launch.executable(), &args)?;
linux_launch(&arma3dir, &launch.executable(), &args)?;
}

Ok(report)
Expand Down

0 comments on commit 1fb6a29

Please sign in to comment.