Skip to content

Commit b650103

Browse files
fix: restore Linux data-dir path in CLI integration tests
The prior fix read XDG_DATA_HOME and APPDATA from the test process, which has none set, so Linux builds computed home/.local/share instead of the child pinned XDG_DATA_HOME and the three macOS-targeted tests then failed on Linux. Derive the data dir purely from the pinned env: macOS keeps its Library/Application Support convention, every other platform is exactly the pinned home dir. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent 367a712 commit b650103

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

crates/cli/tests/docs_regressions.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,19 @@ fn fresh_data_home() -> PathBuf {
2323
}
2424

2525
/// The directory `dirs::data_dir()` resolves to for the child process given the
26-
/// env vars `remi_cmd` sets. macOS and Windows ignore the XDG vars, so the
27-
/// tests must mirror each platform's convention or they seed a DB the app
28-
/// never opens (the cause of the pre-existing macOS-only failures).
26+
/// env vars `remi_cmd` sets. macOS ignores the XDG vars, so the tests must
27+
/// mirror its convention or they seed a DB the app never opens (the cause of
28+
/// the pre-existing macOS-only failures). On Linux and Windows `remi_cmd` pins
29+
/// XDG_DATA_HOME/APPDATA to `home`, which `dirs` honors, so the data dir is
30+
/// exactly `home` there.
2931
fn data_dir_for(home: &Path) -> PathBuf {
3032
#[cfg(target_os = "macos")]
3133
{
3234
home.join("Library").join("Application Support")
3335
}
34-
#[cfg(target_os = "windows")]
36+
#[cfg(not(target_os = "macos"))]
3537
{
36-
// `dirs::data_dir()` on Windows is %APPDATA% (Roaming).
37-
std::env::var_os("APPDATA")
38-
.map(PathBuf::from)
39-
.unwrap_or_else(|| home.to_path_buf())
40-
}
41-
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
42-
{
43-
// `dirs::data_dir()` honors $XDG_DATA_HOME when set, else $HOME/.local/share.
44-
std::env::var_os("XDG_DATA_HOME")
45-
.map(PathBuf::from)
46-
.unwrap_or_else(|| home.join(".local").join("share"))
38+
home.to_path_buf()
4739
}
4840
}
4941

0 commit comments

Comments
 (0)