summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorRitt Konstantin <ritt.ks@gmail.com>2010-01-29 12:12:40 (GMT)
committerJoão Abecasis <joao@trolltech.com>2010-01-29 12:12:40 (GMT)
commitb915461519f1a4b7da8920203529e315eee39323 (patch)
tree47fb91e5ad0ac81b1e93e40ab6592cae8690ed86 /src/corelib
parent57f72b0c2c2f717b267518da7f03dd08576c4df4 (diff)
downloadQt-b915461519f1a4b7da8920203529e315eee39323.zip
Qt-b915461519f1a4b7da8920203529e315eee39323.tar.gz
Qt-b915461519f1a4b7da8920203529e315eee39323.tar.bz2
optimize QDir::cd()
We already create a file engine for testing if dir exists. We can also use it as source for current QDir. Merge-request: 445 Reviewed-by: João Abecasis <joao@trolltech.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qdir.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 3a04920..eb02e6c 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -929,14 +929,13 @@ bool QDir::cd(const QString &dirName)
}
}
}
- {
- QFileInfo fi(newPath);
- if (!(fi.exists() && fi.isDir()))
- return false;
- }
- d->setPath(newPath);
- refresh();
+ QDir dir(*this);
+ dir.setPath(newPath);
+ if (!dir.exists())
+ return false;
+
+ *this = dir;
return true;
}