diff options
| author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-04-05 23:49:23 +0000 |
|---|---|---|
| committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2008-04-05 23:49:23 +0000 |
| commit | be698f086de4641a45dffd9289671588c2391a3c (patch) | |
| tree | 462be2cf175f6751cdbb2547545c8cce11ff257b | |
| parent | 229c64ba67b2efad976417314eaef31de20af1a0 (diff) | |
| download | rockbox-be698f086de4641a45dffd9289671588c2391a3c.zip rockbox-be698f086de4641a45dffd9289671588c2391a3c.tar.gz rockbox-be698f086de4641a45dffd9289671588c2391a3c.tar.bz2 rockbox-be698f086de4641a45dffd9289671588c2391a3c.tar.xz | |
make resolvePathCase work properly on windows, the drive letter needs special handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16980 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | rbutil/rbutilqt/utils.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/utils.cpp b/rbutil/rbutilqt/utils.cpp index d77a1ac..f18a15e 100644 --- a/rbutil/rbutilqt/utils.cpp +++ b/rbutil/rbutilqt/utils.cpp @@ -61,10 +61,21 @@ bool recRmdir( const QString &dirName ) QString resolvePathCase(QString path) { QStringList elems; - QString realpath = "/"; + QString realpath; + elems = path.split("/", QString::SkipEmptyParts); + int start; +#if defined(Q_OS_WIN32) + // on windows we must make sure to start with the first entry (i.e. the + // drive letter) instead of a single / to make resolving work. + start = 1; + realpath = elems.at(0) + "/"; +#else + start = 0; + realpath = "/"; +#endif - for(int i = 0; i < elems.size(); i++) { + for(int i = start; i < elems.size(); i++) { QStringList direlems = QDir(realpath).entryList(QDir::AllEntries); if(direlems.contains(elems.at(i), Qt::CaseInsensitive)) { // need to filter using QRegExp as QStringList::filter(QString) |