Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
4.8.4
-
None
-
Windows 7
Description
If you construct a QDir with a junk string, like this:
QString s = "junk"; QDir dir(s); bool exists = dir.exists(); // false - correct
The exists() test will return false (correct).
But if you pass an empty string to the constructor, exists() will always return true;
QString s = "";
QDir dir(s);
bool exists = dir.exists(); // true - incorrect!
The workaround is to construct the QDir using the default constructor and use the setPath function to initialize it:
QString s = "";
QDir dir;
dir.setPath(s);
bool exists = dir.exists(); // false - correct