diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2010-01-29 12:12:40 (GMT) |
---|---|---|
committer | João Abecasis <joao@trolltech.com> | 2010-01-29 12:12:40 (GMT) |
commit | b915461519f1a4b7da8920203529e315eee39323 (patch) | |
tree | 47fb91e5ad0ac81b1e93e40ab6592cae8690ed86 /src/corelib | |
parent | 57f72b0c2c2f717b267518da7f03dd08576c4df4 (diff) | |
download | Qt-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.cpp | 13 |
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; } |