[Interest] Issue on windows with canonicalFilePath

Scott Aron Bloom scott.bloom at onshorecs.com
Thu Aug 29 04:14:03 CEST 2013

Its also broken if the link points to a UNC path.


-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of Scott Aron Bloom
Sent: Wednesday, August 28, 2013 6:42 PM
To: qt-interest (interest at qt-project.org)
Subject: [Interest] Issue on windows with canonicalFilePath

On the Windows system there was a directory created using mklink (microsofts version of ln), I have found I a bug in QFileInfo::canonicalFilePath;

Here is the code
#include <QApplication>
#include <QFileInfo>
#include <QDir>
#include <QDebug>
using namespace std;
int main( int argc, char ** argv )
    QApplication appl( argc, argv );

    QString linkDir = argv[ 1 ];

    QString absFilePath = QFileInfo( relToDir ).canonicalFilePath();

   qDebug() << absFilePath;
    return 0;

Here is the problem if argv[ 1 ] is a directory with a soft link in the path structure, I expected the results to remove the link and put in the actual path.. However its DROPPING the drive name from the return value (tested on win7 and win8)

It works fine on linux.

What apparently is going on, in the core for qfsfileengine_win.cpp, in the analysis of the symbolic link, MS does not return the drive ( in the return value to DeviceIoControl).. and it has to be put back on.

Has this been fixed in Qt 5?  

If not Ill file a bug... 

Interest mailing list
Interest at qt-project.org

More information about the Interest mailing list