diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-08-30 17:28:02 +0200 |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-08-30 18:26:00 +0200 |
commit | 900eb656849d4fa3ff119305c08b631c76fae75e (patch) | |
tree | 647f2f7c1c3d23023474537ce7062238ff823701 /src/corelib/io/qfsfileengine_unix.cpp | |
parent | 1bdc1dfda903426e7a0bd844c48e67ff9e6b6a94 (diff) |
Move canonicalPath() to the new qfilesystemengine_unix
Reviewed-by: João Abecasis
Diffstat (limited to 'src/corelib/io/qfsfileengine_unix.cpp')
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 3daf7f6792..29491f5277 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1027,25 +1027,16 @@ QString QFSFileEngine::fileName(FileName file) const } else if (file == PathName) { return d->fileEntry.path(); } else if (file == AbsoluteName || file == AbsolutePathName) { - QFileSystemEntry entry = QFileSystemEngine::absoluteName(d->fileEntry); + QFileSystemEntry entry(QFileSystemEngine::absoluteName(d->fileEntry)); if (file == AbsolutePathName) { return entry.path(); } return entry.filePath(); } else if (file == CanonicalName || file == CanonicalPathName) { - if (!(fileFlags(ExistsFlag) & ExistsFlag)) - return QString(); - - QString ret = QFSFileEnginePrivate::canonicalized(fileName(AbsoluteName)); - if (file == CanonicalPathName && !ret.isEmpty()) { - int slash = ret.lastIndexOf(QLatin1Char('/')); - if (slash == -1) - ret = QDir::currentPath(); - else if (slash == 0) - ret = QLatin1String("/"); - ret = ret.left(slash); - } - return ret; + QFileSystemEntry entry(QFileSystemEngine::canonicalName(d->fileEntry)); + if (file == CanonicalPathName) + return entry.path(); + return entry.filePath(); } else if (file == LinkName) { if (d->isSymlink()) { #if defined(__GLIBC__) && !defined(PATH_MAX) |