Skip to content

Commit 0107372

Browse files
committed
Do not overwrite existing rust-version file
1 parent b95c34e commit 0107372

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/bin/josh_sync.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,14 @@ fn main() -> anyhow::Result<()> {
5757
.write(Path::new(DEFAULT_CONFIG_PATH))
5858
.context("cannot write config")?;
5959
println!("Created config file at {DEFAULT_CONFIG_PATH}");
60-
std::fs::write(DEFAULT_RUST_VERSION_PATH, "")
61-
.context("cannot write rust-version file")?;
62-
println!("Created empty rust-version file at {DEFAULT_RUST_VERSION_PATH}");
60+
61+
if !Path::new(DEFAULT_RUST_VERSION_PATH).is_file() {
62+
std::fs::write(DEFAULT_RUST_VERSION_PATH, "")
63+
.context("cannot write rust-version file")?;
64+
println!("Created empty rust-version file at {DEFAULT_RUST_VERSION_PATH}");
65+
} else {
66+
println!("{DEFAULT_RUST_VERSION_PATH} already exists, not doing anything with it");
67+
}
6368
}
6469
Command::Pull {
6570
config_path,

0 commit comments

Comments
 (0)