diff -r 771168ee2c76 -r fe67489523b5 src/libraries.cpp --- a/src/libraries.cpp Sun Nov 03 13:18:55 2019 +0200 +++ b/src/libraries.cpp Sun Nov 03 17:57:21 2019 +0200 @@ -44,22 +44,30 @@ * @param fileName File to search for * @return Full path to the file, or empty string if not found. */ -QFileInfo LibraryManager::findFile(QString fileName) const +QString LibraryManager::findFile(QString fileName) const { - QFileInfo path; + QString path; fileName.replace("\\", "/"); bool found = false; for (const Library& library : this->libraries) { - path = library.path.absoluteFilePath(fileName); - if (path.exists() && path.isFile()) + for (const QString& subdirectory : {"parts", "p"}) { - found = true; + QDir directory = library.path; + directory.cd(subdirectory); + QFileInfo fileInfo = directory.absoluteFilePath(fileName); + if (fileInfo.exists() && fileInfo.isFile()) + { + path = fileInfo.absoluteFilePath(); + found = true; + break; + } + } + if (found) + { break; } } - if (not found) - path = {}; return path; }