Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.16
-
None
Description
While constructing a QFileInfo with QFileInfo::QFileInfo(const QDir &dir, const QString &file) with a default constructed QDir and QString (both empty), calling QFileInfo::fileName() returns "." instead of an empty QString. Here's an example:
// provided variables that turned out to be empty QDir emptyDir; QString emptyFile; QFileInfo fileInfo(emptyDir, emptyFile); if(fileInfo.fileName().isEmpty()) { // this check failes, fileName is actually "." // do something }
QDir("") becoming "." is sane and documented:
https://doc.qt.io/qt-6/qdir.html#QDir-1
If path is empty the program's working directory, ("."), is used
But I would think QFileInfo(..., file).fileName() == file should be true