summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qdir.cpp6
-rw-r--r--src/corelib/io/qfilesystemengine_symbian.cpp2
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp2
-rw-r--r--src/corelib/io/qfilesystementry.cpp24
-rw-r--r--src/corelib/io/qfilesystementry_p.h2
-rw-r--r--src/corelib/io/qfsfileengine.cpp4
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
7 files changed, 33 insertions, 9 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index e9bc012..22a3baa 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -177,7 +177,7 @@ inline void QDirPrivate::setPath(const QString &path)
p.truncate(p.length() - 1);
}
- dirEntry = QFileSystemEntry(p);
+ dirEntry = QFileSystemEntry(p, QFileSystemEntry::FromInternalPath());
metaData.clear();
initFileEngine();
clearFileLists();
@@ -198,7 +198,7 @@ inline void QDirPrivate::resolveAbsoluteEntry() const
if (dirEntry.isRelative()) {
QFileSystemEntry answer = QFileSystemEngine::absoluteName(dirEntry);
- absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(answer.filePath()));
+ absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(answer.filePath()), QFileSystemEntry::FromInternalPath());
} else {
absoluteDirEntry = dirEntry;
}
@@ -1757,7 +1757,7 @@ QChar QDir::separator()
*/
bool QDir::setCurrent(const QString &path)
{
- return QFileSystemEngine::setCurrentPath(QFileSystemEntry(fromNativeSeparators(path)));
+ return QFileSystemEngine::setCurrentPath(QFileSystemEntry(path));
}
/*!
diff --git a/src/corelib/io/qfilesystemengine_symbian.cpp b/src/corelib/io/qfilesystemengine_symbian.cpp
index 89a2b29..c4e8d36 100644
--- a/src/corelib/io/qfilesystemengine_symbian.cpp
+++ b/src/corelib/io/qfilesystemengine_symbian.cpp
@@ -148,7 +148,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
result.append(orig);
}
- return QFileSystemEntry(symbianCleanAbsolutePath(result));
+ return QFileSystemEntry(symbianCleanAbsolutePath(result), QFileSystemEntry::FromInternalPath());
}
//static
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 53b9e43..8fa4d62 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -444,7 +444,7 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
ret = readLink(link);
else if (data.isLink())
ret = readSymLink(link);
- return QFileSystemEntry(QDir::fromNativeSeparators(ret));
+ return QFileSystemEntry(ret);
}
//static
diff --git a/src/corelib/io/qfilesystementry.cpp b/src/corelib/io/qfilesystementry.cpp
index bc7f121..d4c6d0a 100644
--- a/src/corelib/io/qfilesystementry.cpp
+++ b/src/corelib/io/qfilesystementry.cpp
@@ -81,7 +81,25 @@ QFileSystemEntry::QFileSystemEntry()
{
}
+/*!
+ \internal
+ Use this constructor when the path is supplied by user code, as it may contain a mix
+ of '/' and the native separator.
+ */
QFileSystemEntry::QFileSystemEntry(const QString &filePath)
+ : m_filePath(QDir::fromNativeSeparators(filePath)),
+ m_lastSeparator(-2),
+ m_firstDotInFileName(-2),
+ m_lastDotInFileName(0)
+{
+}
+
+/*!
+ \internal
+ Use this constructor when the path is guaranteed to be in internal format, i.e. all
+ directory separators are '/' and not the native separator.
+ */
+QFileSystemEntry::QFileSystemEntry(const QString &filePath, FromInternalPath /* dummy */)
: m_filePath(filePath),
m_lastSeparator(-2),
m_firstDotInFileName(-2),
@@ -89,6 +107,10 @@ QFileSystemEntry::QFileSystemEntry(const QString &filePath)
{
}
+/*!
+ \internal
+ Use this constructor when the path comes from a native API
+ */
QFileSystemEntry::QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath /* dummy */)
: m_nativeFilePath(nativeFilePath),
m_lastSeparator(-2),
@@ -98,7 +120,7 @@ QFileSystemEntry::QFileSystemEntry(const NativePath &nativeFilePath, FromNativeP
}
QFileSystemEntry::QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath)
- : m_filePath(filePath),
+ : m_filePath(QDir::fromNativeSeparators(filePath)),
m_nativeFilePath(nativeFilePath),
m_lastSeparator(-2),
m_firstDotInFileName(-2),
diff --git a/src/corelib/io/qfilesystementry_p.h b/src/corelib/io/qfilesystementry_p.h
index 7a9c2a5..2ce0a83 100644
--- a/src/corelib/io/qfilesystementry_p.h
+++ b/src/corelib/io/qfilesystementry_p.h
@@ -72,10 +72,12 @@ public:
typedef QString NativePath;
#endif
struct FromNativePath{};
+ struct FromInternalPath{};
QFileSystemEntry();
explicit QFileSystemEntry(const QString &filePath);
+ QFileSystemEntry(const QString &filePath, FromInternalPath dummy);
QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath dummy);
QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath);
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 9c8df39..5491caf 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -140,7 +140,7 @@ QFSFileEngine::QFSFileEngine(const QString &file)
: QAbstractFileEngine(*new QFSFileEnginePrivate)
{
Q_D(QFSFileEngine);
- d->fileEntry = QFileSystemEntry(QDir::fromNativeSeparators(file));
+ d->fileEntry = QFileSystemEntry(file);
}
/*!
@@ -189,7 +189,7 @@ void QFSFileEngine::setFileName(const QString &file)
{
Q_D(QFSFileEngine);
d->init();
- d->fileEntry = QFileSystemEntry(QDir::fromNativeSeparators(file));
+ d->fileEntry = QFileSystemEntry(file);
}
/*!
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 96946d6..28e0677 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -640,7 +640,7 @@ bool QFSFileEngine::caseSensitive() const
bool QFSFileEngine::setCurrentPath(const QString &path)
{
- return QFileSystemEngine::setCurrentPath(QFileSystemEntry(QDir::fromNativeSeparators(path)));
+ return QFileSystemEngine::setCurrentPath(QFileSystemEntry(path));
}
QString QFSFileEngine::currentPath(const QString &)