Problem with QDir::cdUp()
Hello everyone. Now I want to access the parent directory by using cdUp(). For example, when the current directory is C:\SampleRoot\SampleFolder and I'd like to access C:\SampleRoot:
Code:
tmpCurrDir.cdUp();
QString rootDir
= tmpCurrDir.
currentPath();
Even if there is a existed directory and cdUp() always return true, but when calling the currentPath() it will give C:\SampleRoot\SampleFolder not C:\SampleRoot. So what should I do?
Thanks a lot for everyone! :D
Re: Problem with QDir::cdUp()
From the docs:
Quote:
QString QDir::currentPath () [static]
Returns the absolute path of the application's current directory.
Use QDir:: path() instead
Code:
QString rootDir
= tmpCurrDir.
path();