Georg, Enrico,
something is wrong with the file encoding in Buffer::save(). If I save
changes to an (existing) file which is located in a path containing
German Umlauts (Windows), an exception is thrown. The exception message
isn't very useful. I says that the copy operation failed :-(
The value of pimpl_->filename.toFilesystemEncoding() is (console output):
C:/dokumente und einstellungen/me/eigene
dateien/foo/Veröffentlichungen/bar//foo.lyx
The value of s is:
C:/dokumente und einstellungen/me/eigene
dateien/foo/Veröffentlichungen/bar/foo.lyx~
Any idea? (I surprises me that I am the only one having this problem)
Michael
// Should probably be moved to somewhere else: BufferView? LyXView?
bool Buffer::save() const
{
...
// make a backup if the file already exists
string s;
if (lyxrc.make_backup &&
fs::exists(pimpl_->filename.toFilesystemEncoding())) {
s = fileName() + '~';
if (!lyxrc.backupdir_path.empty())
s = addName(lyxrc.backupdir_path,
subst(os::internal_path(s),'/','!'));
try {
fs::copy_file(pimpl_->filename.toFilesystemEncoding(), 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())));
lyxerr << "Fs error: "
<< fe.what() << endl;
}
}
...
}