]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileName.cpp
an example for the sweave module, prepared by Gregor Gorjanc
[lyx.git] / src / support / FileName.cpp
index 07af66d8734fad4e94b723803f31513653730e88..2a1815ec5b03a8468d3cbcd3c9db6de49994dc48 100644 (file)
@@ -105,7 +105,7 @@ struct FileName::Private
 
        Private(string const & abs_filename) : fi(toqstr(abs_filename))
        {
-               name = abs_filename;
+               name = fromqstr(fi.absoluteFilePath());
                fi.setCaching(fi.exists() ? true : false);
        }
        ///
@@ -212,8 +212,8 @@ string FileName::realPath() const
 
 void FileName::set(string const & name)
 {
-       d->name = name;
        d->fi.setFile(toqstr(name));
+       d->name = fromqstr(d->fi.absoluteFilePath());
        //LYXERR(Debug::FILES, "FileName::set(" << name << ')');
        LASSERT(empty() || isAbsolute(d->name), /**/);
 }
@@ -407,7 +407,9 @@ FileNameList FileName::dirList(string const & ext) const
                return dirlist;
        }
 
-       QDir dir = d->fi.absoluteDir();
+       // If the directory is specified without a trailing '/', absoluteDir()
+       // would return the parent dir, so we must use absoluteFilePath() here.
+       QDir dir = d->fi.absoluteFilePath();
 
        if (!ext.empty()) {
                QString filter;