]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
Embedding: merge lyx::EmbeddedFiles to lyx::support::EmbeddedFileList
[lyx.git] / src / support / FileName.cpp
index 1f7803dec4e61fca6b5800951c23bf9250dac145..e847ecc5a2ace72d7073febeb51644fb4e69e23d 100644 (file)
@@ -155,7 +155,6 @@ string FileName::absFilename() const
 void FileName::set(string const & name)
 {
        d->fi.setFile(toqstr(name));
-       BOOST_ASSERT(d->fi.isAbsolute());
 }
 
 
@@ -199,11 +198,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 "
@@ -267,13 +261,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.path());
+       return path;
 }
 
 
@@ -857,8 +853,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;
 }