Relative path to absolute path
I need to turn a relative path to an absolute path.
I know how to do the opposite:
QDir TestDir("/Home/User/TestDir"); QString strRelative = TestDir.relativeFilePath("/Home/User/AnotherDir");
So strRelative is "../AnotherDir".
Is there a way to convert the relative file (../AnotherDir) to get to the absolute (/Home/User/AnotherDir)?
It doesn't work. That gives me only " . "
I found my solution:
QDir TestDir("/Home/User/TestDir"); QString AbsolutePath = TestDir.cleanPath(TestDir.absoluteFilePath("../AnotherDir"));
I don't know if it's the right way, but it works.
Thanks anyway for the Answer VRonin.