Hi Georg, Few nitpicks inline.
On 29/11/2015 18:53, Georg Baum wrote:
The investigation of bug 9139 showed that the error message we give when a file operation fails is not too clever. The attached patch improves this. It is still not optimal (since qt has a very limited set of error causes that are reported), but if we want to get the real error from the OS we have to implement it in a platform specific way. In my experience error messages that are as exact as possible help a lot when investigating bug reports: You need to ask less questions, since the bug report itself will contain more information.
Fully agreed.
OK to go in? Georg diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 9506666..3423972 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -238,10 +238,17 @@ bool FileName::copyTo(FileName const & name, bool keepsymlink, return copyTo(target, true); } QFile::remove(name.d->fi.absoluteFilePath()); - bool success = QFile::copy(d->fi.absoluteFilePath(), name.d->fi.absoluteFilePath()); - if (!success) - LYXERR0("FileName::copyTo(): Could not copy file " - << *this << " to " << name); + QFile f(d->fi.absoluteFilePath()); + bool const success = f.copy(name.d->fi.absoluteFilePath());
if (f.copy(name.d->fi.absoluteFilePath())) return true;
+ if (!success) {
remove
+ QString const error(f.errorString()); + if (error.isEmpty()) + LYXERR0("FileName::copyTo(): Could not copy file " + << *this << " to " << name); + else + LYXERR0("FileName::copyTo(): Could not copy file " + << *this << " to " << name << ": " << fromqstr(error)); + }
LYXERR0("FileName::copyTo(): Could not copy file " << *this << " to " << name); sting const error = fromqstr(f.errorString()); if (!error.empty()) LYXERR0(": " << error);
return success;
return false; Same comments for renameTo() and moveTo() Cheers, Abdel. PS: congratz to all for LyX 2.2 alpha delivery, looks very promising!