- Create a new file
- save

=> LyX complains it could not create a backup, which is
understandable, since there is nothing to backup!

The following patch seems to fix the logic.

Juergen, do you agree?

JMarc

Index: src/buffer.C
===================================================================
--- src/buffer.C	(revision 14591)
+++ src/buffer.C	(working copy)
@@ -702,21 +702,22 @@ bool Buffer::save() const
 		// But to use this we need fs::copy_file to actually do a copy,
 		// even when the target file exists. (Lgb)
 		if (fs::exists(fileName()) 
-		    && fs::is_writable(fs::path(fileName()).branch_path())
-		    && fs::exists(fs::path(s).branch_path()) 
-		    && fs::is_writable(fs::path(s).branch_path())) {
-		  //try {
-		    fs::copy_file(fileName(), s, false);
-		    //}
-		    //catch (fs::filesystem_error const & fe) {
-		    //lyxerr << "LyX was not able to make backup copy. Beware.\n"
-		    //	   << fe.what() << endl;
-		    //}
-		} else {
-			Alert::error(_("Backup failure"),
-			     bformat(_("LyX was not able to make a backup copy in %1$s.\n"
-				       "Please check if the directory exists and is writeable."),
-				       fs::path(s).branch_path().native_directory_string()));
+		    && fs::is_writable(fs::path(fileName()).branch_path())) {
+			if (fs::exists(fs::path(s).branch_path()) 
+			    && fs::is_writable(fs::path(s).branch_path())) {
+				//try {
+				fs::copy_file(fileName(), s, false);
+				//}
+				//catch (fs::filesystem_error const & fe) {
+				//lyxerr << "LyX was not able to make backup copy. Beware.\n"
+				//	   << fe.what() << endl;
+				//}
+			} else {
+				Alert::error(_("Backup failure"),
+					     bformat(_("LyX was not able to make a backup copy in %1$s.\n"
+						       "Please check if the directory exists and is writeable."),
+						     fs::path(s).branch_path().native_directory_string()));
+			}
 		}
 	}
 

Reply via email to