]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
Improvements to the shortcuts preference dialog (#9174)
[lyx.git] / src / support / FileName.cpp
index 05492f66d14c85a9230ca64ac79937aacd107132..6d40687a2584f2bc912c73578b3c22e3957bf6b6 100644 (file)
@@ -18,7 +18,6 @@
 #include "support/lassert.h"
 #include "support/lstrings.h"
 #include "support/mutex.h"
-#include "support/qstring_helpers.h"
 #include "support/os.h"
 #include "support/Package.h"
 #include "support/qstring_helpers.h"
@@ -249,7 +248,7 @@ bool FileName::copyTo(FileName const & name, bool keepsymlink,
 
 bool FileName::renameTo(FileName const & name) const
 {
-       LYXERR(Debug::FILES, "Renaming " << name);
+       LYXERR(Debug::FILES, "Renaming " << name << " as " << *this);
        bool success = QFile::rename(d->fi.absoluteFilePath(), name.d->fi.absoluteFilePath());
        if (!success)
                LYXERR0("Could not rename file " << *this << " to " << name);
@@ -259,7 +258,7 @@ bool FileName::renameTo(FileName const & name) const
 
 bool FileName::moveTo(FileName const & name) const
 {
-       LYXERR(Debug::FILES, "Moving " << name);
+       LYXERR(Debug::FILES, "Moving " << name << " to " << *this);
        QFile::remove(name.d->fi.absoluteFilePath());
 
        bool success = QFile::rename(d->fi.absoluteFilePath(),
@@ -320,6 +319,9 @@ bool FileName::isSymLink() const
 }
 
 
+//QFileInfo caching info might fool this test if file was changed meanwhile.
+//refresh() helps, but we don't want to put it blindly here, because it might
+//trigger slowdown on networked file systems.
 bool FileName::isFileEmpty() const
 {
        LASSERT(!empty(), return true);
@@ -491,6 +493,12 @@ bool FileName::chdir() const
 }
 
 
+bool FileName::link(FileName const & name) const
+{
+       return QFile::link(toqstr(absFileName()), toqstr(name.absFileName()));
+}
+
+
 unsigned long checksum_ifstream_fallback(char const * file)
 {
        unsigned long result = 0;