[Interest] Issue on windows with canonicalFilePath

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


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... 
Scott





More information about the Interest mailing list