Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
Description
Search paths behave in an unexpected way if not all paths exist. See example below.
The behaviour came through the /etc/data/myfile.txt did not exits and
the "data:" was then not resolved.
Here is an [...] example which shows this behaviour (/home/jryannel/menu.xml exists and /home/jryannel/menu2.xml does not exists).
– source –
#include <QtCore>
int main(int argc, char **argv)
{
QDir::addSearchPath("data", "/home/jryannel/");
qDebug() << "data search path" << QDir::searchPaths("data");
QFile file("data:menu.xml");
qDebug() << "data file path" << QFileInfo(file).absoluteFilePath();
qDebug() << "file exits " << QFile("/home/jryannel/menu.xml").exists();
qDebug() << "file exits " << QFile("data:menu.xml").exists();
QFile file2("data:menu2.xml");
qDebug() << "data file2 path" << QFileInfo(file2).absoluteFilePath();
qDebug() << "file2 exits " << QFile("/home/jryannel/menu2.xml").exists();
qDebug() << "file2 exits " << QFile("data:menu2.xml").exists();
return 0;
}
— output
jryannel@groenland:~/projects/ex/ex5$ ./ex5
data search path ("/home/jryannel/")
data file path "/home/jryannel/menu.xml"
file exits true
file exits true
data file2 path "/home/jryannel/projects/ex/ex5/data:menu2.xml" // not resolved, because does not exists
file2 exits false
file2 exits false