about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2023-06-24 10:20:52 -0700
committerNoah Lev <camelidcamel@gmail.com>2023-06-24 10:23:46 -0700
commitce326918ec0d66b5460ef343553f2e99f3880283 (patch)
tree504c7edd5211eb84a6d8b859be0dfaa01be0f80c
parent69a63737fa111b366bb3f3254806547d7dd15678 (diff)
downloadrust-ce326918ec0d66b5460ef343553f2e99f3880283.tar.gz
rust-ce326918ec0d66b5460ef343553f2e99f3880283.zip
bootstrap: Backup `settings.json` to the correct filename
The old code actually replaced `.json` with `.bak` (so, `settings.bak`),
rather than appending `.bak` as claimed (`settings.json.bak`).

`Path::set_extension` can instead be used with dots:

> The new extension may contain dots and will be used in its entirety,
> but only the part after the final dot will be reflected in
> self.extension.
-rw-r--r--src/bootstrap/setup.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index 7eb70de91f8..9811cf163e5 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -582,7 +582,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
             Some(false) => {
                 // exists and is not current version or outdated, so back it up
                 let mut backup = vscode_settings.clone();
-                backup.set_extension("bak");
+                backup.set_extension("json.bak");
                 eprintln!("warning: copying `settings.json` to `settings.json.bak`");
                 fs::copy(&vscode_settings, &backup)?;
                 "Updated"