Georg Baum schrieb:
FYI: The file is saved correctly. Afterwards, a dialog pops up that
states that no backup could be created (which does not make sense
because the backup directory mentioned does exist).
That is a known problem. I sometimes get this, too, but not always, and I
don't know the reason.
In the code below, we have to check whether the file actually exists before copying it.

Michael


bool Buffer::save() const
{
  ...
       // make a backup
       string s;
       if (lyxrc.make_backup) {
               s = fileName() + '~';
               if (!lyxrc.backupdir_path.empty())
                       s = addName(lyxrc.backupdir_path,
                                   subst(os::internal_path(s),'/','!'));

               try {
                   fs::copy_file(fileName(), s, false);
               }
               catch (fs::filesystem_error const & fe) {
                       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 write
able."),
from_utf8(fs::path(s).branch_path().native_directory_string())));
               }
       }
...
}


Reply via email to