]> git.lyx.org Git - features.git/commitdiff
Fix bug 4193 Revert ask for saving file before closing
authorBo Peng <bpeng@lyx.org>
Tue, 4 Sep 2007 15:03:50 +0000 (15:03 +0000)
committerBo Peng <bpeng@lyx.org>
Tue, 4 Sep 2007 15:03:50 +0000 (15:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20039 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index 77faad5697b05b88dc6060a6ea35bfa6facf444c..324b5016daaa909ec37ef2d3cc711c3321ab1177 100644 (file)
@@ -749,8 +749,14 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
        // to not overwrite them with those of the file created in the tempdir
        // when it has to be converted to the current format.
        if (!pimpl_->checksum_) {
-               pimpl_->timestamp_ = fs::last_write_time(filename.toFilesystemEncoding());
-               pimpl_->checksum_ = sum(filename);
+               // Save the timestamp and checksum of disk file. If filename is an
+               // emergency file, save the timestamp and sum of the original lyx file
+               // because isExternallyModified will check for this file. (BUG4193)
+               string diskfile = filename.toFilesystemEncoding();
+               if (suffixIs(diskfile, ".emergency"))
+                       diskfile = diskfile.substr(0, diskfile.size() - 10);
+               pimpl_->timestamp_ = fs::last_write_time(diskfile);
+               pimpl_->checksum_ = sum(FileName(diskfile));
        }
 
        if (file_format != LYX_FORMAT) {