Save: a folder that can't be made says so, not that the backup failed (#2669)

The backup ran before the folders were made. On Linux, a path under a file
gave 'the backup copy could not be written' instead of naming the folder.
This commit is contained in:
Tanish Manku
2026-11-02 17:10:53 -07:00
committed by GitHub
parent 096b3f9be4
commit eacdbe43ee
+2 -1
View File
@@ -440,7 +440,8 @@ fn save_as(s: &mut Session, cmd: &str, path: &str, opts: &SaveAs) -> Result<usiz
fn store(path: &str, bytes: &[u8]) -> Result<()> {
#[cfg(not(target_arch = "wasm32"))]
{
if is_drawing_file(path) && crate::autosave::isavebak() {
// A file in a folder still to be made has nothing to back up.
if is_drawing_file(path) && crate::autosave::isavebak() && crate::atomic_write::missing_folder(std::path::Path::new(path)).is_none() {
backup(std::path::Path::new(path))
.map_err(|e| bad("save", format!("{path}: the backup copy could not be written ({e}); nothing was saved")))?;
}