Unsolved Problem with QFileInfo::absolutePath() and relative paths as input
-
Hi all,
I think QFileInfo does not return the absolute path as desired using relativ paths! Why?
Windows 7, Qt 5.3.2 and Qt 5.6I want the absolute path of a directory and an file (both of them as absolute and relative path as input to the QFileInfo).
I think there must be is a "/" at the end to differ between files and directory.// My application dir is D:/Test/User/Project. // absolute path as input QString dir1 = QFileInfo( "D:/Test/User/Project/test" ).absolutePath(); QString dir2 = QFileInfo( "D:/Test/User/Project/test/" ).absolutePath(); // relative path as input QString dir3 = QFileInfo( "./test" ).absolutePath(); QString dir4 = QFileInfo( "./test/" ).absolutePath();
This is what I get
dir1 = "D:/Test/User/Project/" dir2 = "D:/Test/User/Project/test/" dir3 = "D:/Test/User/Project/" dir4 = "D:/Test/User/Project/"
What is the problem here? Why do I get a wrong path with dir4, whereas dir4 is definitly a relative directory and not a file?
Btw, the same happens using absoluteDir() to get a QDir Objekt.regards
Oliver -
Additional Information: This works on linux as aspected.