Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1
-
tested on Windows 7 and Windows 10
-
-
ec9e85656339dbc9e6918a1369c981cece7bc97d (qt/qtbase/dev) 9d0be7b1a920cd9d7ae949bc3dc14774a439b3d0 (qt/qtbase/6.0) ad12c3c40b07079d875f48027eef0786acef7de0 (qt/qtbase/6.1)
Description
QFile can successfully open a file to write with a UNC path. QSaveFile cannot open the same file. For example:
QString path = QString( "\\\\drive\\dir\\myfile.txt" ); qDebug() << "path=" << path; QFile f2( path ); if ( f2.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) ) { qDebug() << "QFile ok"; } else { qDebug() << "QFile f.error()=" << f2.error(); qDebug() << "QFile f.errorString()=" << f2.errorString(); } QSaveFile f( path ); if ( f.open( QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text ) ) { qDebug() << "QSaveFile ok"; } else { qDebug() << "QSaveFile f.error()=" << f.error(); qDebug() << "QSaveFile f.errorString()=" << f.errorString(); }
Returns:
path= "\\\\drive\\dir
myfile.txt"
QFile ok
QSaveFile f.error()= 5
QSaveFile f.errorString()= "The system cannot find the path specified."
Attachments
Issue Links
- is required for
-
QTBUG-75129 Rationalize handling of UNC paths on Windows
- Closed
- relates to
-
QTBUG-57299 QSaveFile failure in dropbox folder
- Closed
-
QTBUG-74291 QTemporaryFile does not work for Windows network paths
- Closed