Skip to content

Commit

Permalink
Fix TCLI directory switch and LD_PRELOAD shenanigans
Browse files Browse the repository at this point in the history
  • Loading branch information
Windows10CE committed Apr 12, 2023
1 parent be10037 commit 863912d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ThunderstoreCLI/Game/ModProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal ModProfile(GameDefinition gameDef, string name, string tcliDirectory)
{
Name = name;

var directory = Path.Combine(tcliDirectory, "Profiles", gameDef.Identifier, name);
var directory = Path.GetFullPath(Path.Combine(tcliDirectory, "Profiles", gameDef.Identifier, name));
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
Expand Down
5 changes: 0 additions & 5 deletions ThunderstoreCLI/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ public override bool Validate()
return false;
}

if (!Directory.Exists(TcliDirectory))
{
Directory.CreateDirectory(TcliDirectory!);
}

return true;
}
}
Expand Down
11 changes: 7 additions & 4 deletions tcli-bepinex-installer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,21 +345,24 @@ fn output_instructions(game_dir: PathBuf, bep_dir: PathBuf, platform: GamePlatfo
);

let mut ld_library = OsString::from(game_dir.join("doorstop_libs"));
if let Some(orig) = env::var_os("LD_LIBRARY") {
if let Some(orig) = env::var_os("LD_LIBRARY_PATH") {
ld_library.push(":");
ld_library.push(orig);
}

println!("ENVIRONMENT:LD_LIBRARY={}", ld_library.to_string_lossy());
println!(
"ENVIRONMENT:LD_LIBRARY_PATH={}",
ld_library.to_string_lossy()
);

let mut ld_preload = OsString::from(game_dir.join("doorstop_libs").join({
let mut ld_preload = OsString::from({
// FIXME: properly determine arch of the game exe, instead of assuming its the same as this exe
if cfg!(target_arch = "x86_64") {
"libdoorstop_x64.so"
} else {
"libdoorstop_x86.so"
}
}));
});
if let Some(orig) = env::var_os("LD_PRELOAD") {
ld_preload.push(":");
ld_preload.push(orig);
Expand Down

0 comments on commit 863912d

Please sign in to comment.