nuntawat
29th March 2010, 00:07
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:
QDir tmpCurrDir = QDir::current();
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
QDir tmpCurrDir = QDir::current();
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