]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
Now that exceptions are allowed, handle gracefully the case where a Buffer temp direc...
[lyx.git] / src / support / FileName.cpp
index 5e4ea0ec2ecc4d80df724d53d1047bb283aac80f..298ef969fcce60a56ee5e6563bd3a2d29b0d631f 100644 (file)
@@ -140,6 +140,12 @@ bool FileName::empty() const
 }
 
 
+bool FileName::isAbsolute() const
+{
+       return d->fi.isAbsolute();
+}
+
+
 string FileName::absFilename() const
 {
        return fromqstr(d->fi.absoluteFilePath());
@@ -193,11 +199,6 @@ bool FileName::moveTo(FileName const & name) const
 
 bool FileName::changePermission(unsigned long int mode) const
 {
-       if (!isWritable()) {
-               LYXERR0("File " << *this << " is not writable!");
-               return false;
-       }
-
 #if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
        if (::chmod(toFilesystemEncoding().c_str(), mode_t(mode)) != 0) {
                LYXERR0("File " << *this << ": cannot change permission to "
@@ -261,13 +262,15 @@ bool FileName::isReadableDirectory() const
 
 string FileName::onlyFileName() const
 {
-       return support::onlyFilename(absFilename());
+       return fromqstr(d->fi.fileName());
 }
 
 
 FileName FileName::onlyPath() const
 {
-       return FileName(support::onlyPath(absFilename()));
+       FileName path;
+       path.d->fi.setFile(d->fi.filePath());
+       return path;
 }
 
 
@@ -851,8 +854,9 @@ DocFileName::DocFileName(FileName const & abs_filename, bool save_abs)
 
 void DocFileName::set(string const & name, string const & buffer_path)
 {
-       save_abs_path_ = absolutePath(name);
-       FileName::set(save_abs_path_ ? name : makeAbsPath(name, buffer_path).absFilename());
+       FileName::set(name);
+       if (!isAbsolute())
+               FileName::set(makeAbsPath(name, buffer_path).absFilename());
        zipped_valid_ = false;
 }