Am 02.11.2010 um 07:31 schrieb Stephan Witt: > Am 01.11.2010 um 23:42 schrieb Pavel Sanda: > >> Stephan Witt wrote: >>
>>> 3) Want the readFile() issue fixed. >> >> is this beta1 critical stuf? > > After my last commit in readFile() it's "only" the issue with file_found_hook > being called with the wrong file name in case of autosave and emergency. > I'd like to fix it before (2) or maybe Vincent does it... > For users of VCS I'd rate it as a serious problem - but not critical. To illustrate my plan I post a patch - it's compiling and I tested it quickly. I hope that's acceptable. Vincent? Do you have a better proposal? Stephan
Index: src/Buffer.h =================================================================== --- src/Buffer.h (Revision 35961) +++ src/Buffer.h (Arbeitskopie) @@ -196,6 +196,7 @@ /// emergency or autosave files, one should use \c loadLyXFile. /// /sa loadLyXFile ReadStatus loadThisLyXFile(support::FileName const & fn); + ReadStatus loadThisLyXFile(support::FileName const & fn, support::FileName const & on); /// read a new document from a string bool readString(std::string const &); /// Reloads the LyX file @@ -209,7 +210,7 @@ private: /// read a new file - ReadStatus readFile(support::FileName const & fn); + ReadStatus readFile(support::FileName const & fn, support::FileName const & on); /// Reads a file without header. /// \param par if != 0 insert the file. /// \return \c true if file is not completely read. Index: src/Buffer.cpp =================================================================== --- src/Buffer.cpp (Revision 35985) +++ src/Buffer.cpp (Arbeitskopie) @@ -847,7 +847,7 @@ os << s; os.close(); // lyxvc in readFile - return readFile(fn) == ReadSuccess; + return readFile(fn, FileName()) == ReadSuccess; } if (readDocument(lex)) @@ -856,7 +856,7 @@ } -Buffer::ReadStatus Buffer::readFile(FileName const & fn) +Buffer::ReadStatus Buffer::readFile(FileName const & fn, FileName const & on) { FileName fname(fn); Lexer lex; @@ -872,11 +872,11 @@ ReadStatus const ret_clf = convertLyXFormat(fn, tmpFile, file_format); if (ret_clf != ReadSuccess) return ret_clf; - return readFile(tmpFile); + return readFile(tmpFile, FileName()); } // InsetInfo needs to know if file is under VCS - lyxvc().file_found_hook(fn); + lyxvc().file_found_hook(on.empty() ? fn : on); if (readDocument(lex)) { Alert::error(_("Document format failure"), @@ -3647,7 +3647,7 @@ { case 0: { docstring str; - ReadStatus const ret_llf = loadThisLyXFile(emergencyFile); + ReadStatus const ret_llf = loadThisLyXFile(emergencyFile, fn); bool const success = (ret_llf == ReadSuccess); if (success) { markDirty(); @@ -3703,7 +3703,7 @@ switch (ret) { case 0: { - ReadStatus const ret_llf = loadThisLyXFile(autosaveFile); + ReadStatus const ret_llf = loadThisLyXFile(autosaveFile, fn); // the file is not saved if we load the autosave file. if (ret_llf == ReadSuccess) { markDirty(); @@ -3739,13 +3739,19 @@ if (ret_ra == ReadSuccess || ret_ra == ReadCancel) return ret_ra; - return loadThisLyXFile(fn); + return loadThisLyXFile(fn, FileName()); } +Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn, FileName const & on) +{ + return readFile(fn, on); +} + + Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn) { - return readFile(fn); + return readFile(fn, FileName()); }