Skip to content

Commit f74448e

Browse files
committed
fix: preserve file extensions in pull_from_gist backup (line 674)
Applies the same fix from line 551 to line 674: use with_file_name(format!("{}.bak", file_name)) instead of with_extension("md.bak") to append .bak extension rather than replace it. Ensures settings.json → settings.json.bak instead of settings.md.bak
1 parent 1c55739 commit f74448e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src-tauri/src/commands/cloud_sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use tauri::State;
1616
fn find_gh() -> std::path::PathBuf {
1717
for candidate in &[
1818
"/opt/homebrew/bin/gh", // Homebrew on Apple Silicon
19-
"/usr/local/bin/gh", // Homebrew on Intel / manual install
20-
"/usr/bin/gh", // System install
19+
"/usr/local/bin/gh", // Homebrew on Intel / manual install
20+
"/usr/bin/gh", // System install
2121
] {
2222
if std::path::Path::new(candidate).exists() {
2323
return candidate.into();

src-tauri/src/services/gist_sync.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,12 @@ pub fn apply_pulled_payload(
682682
}
683683
// Back up existing file before overwriting
684684
if claude_md_path.exists() {
685-
let backup = claude_md_path.with_extension("md.bak");
685+
let file_name = claude_md_path
686+
.file_name()
687+
.unwrap_or_default()
688+
.to_string_lossy();
689+
let backup =
690+
claude_md_path.with_file_name(format!("{}.bak", file_name));
686691
let _ = std::fs::copy(&claude_md_path, &backup);
687692
}
688693
if let Err(e) = std::fs::write(&claude_md_path, content) {

0 commit comments

Comments
 (0)