forked from len0rd/rockbox
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
This commit is contained in:
parent
229c64ba67
commit
be698f086d
1 changed files with 14 additions and 3 deletions
|
|
@ -61,10 +61,21 @@ bool recRmdir( const QString &dirName )
|
|||
QString resolvePathCase(QString path)
|
||||
{
|
||||
QStringList elems;
|
||||
QString realpath = "/";
|
||||
elems = path.split("/", QString::SkipEmptyParts);
|
||||
QString realpath;
|
||||
|
||||
for(int i = 0; i < elems.size(); i++) {
|
||||
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 = 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue