Skip to content

Commit 93d64e4

Browse files
committed
Add support for Linux scriptslog path
1 parent 62efeaf commit 93d64e4

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/core/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ pub const TYPE_STRING_UTF8: [u8; 2] = [0xAC, 0x08];
3838
pub const TYPE_STRING_UTF16: [u8; 2] = [0x9C, 0x16];
3939

4040

41-
pub const SCRIPTSLOG_FILE_NAME: &str = "scriptslog.txt";
41+
pub const SCRIPTSLOG_FILE_NAME: &str = "scriptslog.txt";
42+
pub const LINUX_STEAM_PFX_PATH: &str = ".local/share/Steam/steamapps/compatdata/292030/pfx/drive_c/users/steamuser/Documents"; // it's ok to use forward slashes because this is Linux-specific

src/core/scriptslog.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,16 @@ where P: Fn(&String) -> () {
5959
fn scriptslog_file() -> Result<File, String> {
6060
let mut docs = None;
6161
if let Some(ud) = UserDirs::new() {
62-
if let Some(path) = ud.document_dir() {
63-
docs = Some(path.to_owned());
62+
if cfg!(windows) {
63+
if let Some(path) = ud.document_dir() {
64+
docs = Some(path.to_owned());
65+
}
66+
} else if cfg!(unix) {
67+
if let Some(path) = Some(ud.home_dir()) {
68+
docs = Some(path.join(constants::LINUX_STEAM_PFX_PATH).to_owned());
69+
}
70+
} else {
71+
unimplemented!();
6472
}
6573
}
6674

0 commit comments

Comments
 (0)