Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.2.0 RC
-
None
Description
#include <QDebug> int main(int argc, char *argv[]) { qDebug() << QFile::link("../../a", "/tmp/a.link"); qDebug() << QFileInfo("/tmp/a.link").symLinkTarget(); return 0; }
The output is:
Output of Qt
true
"/../a"
Output of 'ls -lh' command
/tmp/a.link -> ../../a
The expected is:
Expected Output of Qt
true
"../../a"
Yes, i have looked the document of the QFile::symLinkTarget, it's in flowing:
QFile::symLinkTarget
Returns the absolute path to the file or directory a symbolic link points to, or an empty string if the object isn't a symbolic link.
This name may not represent an existing file; it is only a string. QFileInfo::exists() returns true if the symlink points to an existing file.
This function was introduced in Qt 4.2.
See also exists(), isSymLink(), isDir(), and isFile().
But, i can't get the "../../a" from the "/../a", why it's returns the absolute path? How can i get the origin symlink path on Qt?