]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
there is no trunk/src/intl folder
[lyx.git] / src / support / FileName.cpp
index 1f7803dec4e61fca6b5800951c23bf9250dac145..fb30988f9b6ace37de1c23f99c4435b6f9a6f7d1 100644 (file)
@@ -28,7 +28,7 @@
 #include <QList>
 #include <QTime>
 
-#include <boost/assert.hpp>
+#include "support/assert.h"
 #include <boost/scoped_array.hpp>
 
 #include <map>
@@ -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;
 }
 
 
@@ -527,14 +523,14 @@ static int mymkdir(char const * pathname, unsigned long int mode)
 
 bool FileName::createDirectory(int permission) const
 {
-       BOOST_ASSERT(!empty());
+       LASSERT(!empty(), /**/);
        return mymkdir(toFilesystemEncoding().c_str(), permission) == 0;
 }
 
 
 bool FileName::createPath() const
 {
-       BOOST_ASSERT(!empty());
+       LASSERT(!empty(), /**/);
        if (isDirectory())
                return true;
 
@@ -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;
 }