]> git.lyx.org Git - features.git/commitdiff
Save the right timestamp and checksum of an opened file.
authorEnrico Forestieri <forenr@lyx.org>
Thu, 30 Aug 2007 14:50:12 +0000 (14:50 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Thu, 30 Aug 2007 14:50:12 +0000 (14:50 +0000)
* src/Buffer.cpp (Buffer::readFile): save timestamp and checksum
of the original disk file, and not those of the file converted
to current format.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19916 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index f363d1c40e3fefe0fa6cff1759c15cffdac0ff96..267da451ec706c50ec5b915b9954f44e9e826448 100644 (file)
@@ -704,6 +704,14 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
        int const file_format = convert<int>(tmp_format);
        //lyxerr << "format: " << file_format << endl;
 
+       // save timestamp and checksum of the original disk file, making sure
+       // 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);
+       }
+
        if (file_format != LYX_FORMAT) {
 
                if (fromstring)
@@ -770,9 +778,6 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
        //MacroTable::localMacros().clear();
 
        pimpl_->file_fully_loaded = true;
-       // save the timestamp and checksum of disk file
-       pimpl_->timestamp_ = fs::last_write_time(filename.toFilesystemEncoding());
-       pimpl_->checksum_ = sum(filename);
        return success;
 }