Skip to content

Commit f3ca921

Browse files
authored
Ensure the CLI data dir exists (#6953)
This fixes the first-time run for many CLI tools. I noticed this issue when I tried to run these tools in moz-central, where I didn't have a `.cli-data` directory yet.
1 parent 8ba04a3 commit f3ca921

File tree

1 file changed

+3
-0
lines changed
  • examples/cli-support/src

1 file changed

+3
-0
lines changed

examples/cli-support/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn init_logging_with(default_env: &str) {
2828
}
2929

3030
pub fn cli_data_dir() -> String {
31+
ensure_cli_data_dir_exists();
3132
data_path(None).to_string_lossy().to_string()
3233
}
3334

@@ -39,10 +40,12 @@ pub fn ensure_cli_data_dir_exists() {
3940
}
4041

4142
pub fn cli_data_subdir(relative_path: &str) -> String {
43+
ensure_cli_data_dir_exists();
4244
data_path(Some(relative_path)).to_string_lossy().to_string()
4345
}
4446

4547
pub fn cli_data_path(filename: &str) -> String {
48+
ensure_cli_data_dir_exists();
4649
data_path(None).join(filename).to_string_lossy().to_string()
4750
}
4851

0 commit comments

Comments
 (0)