4040#include < QByteArray>
4141#include < QCheckBox>
4242#include < QComboBox>
43- #include < QCoreApplication>
4443#include < QDialogButtonBox>
4544#include < QDir>
4645#include < QFileDialog>
@@ -142,22 +141,10 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWi
142141
143142 mUI ->premiumLicense ->setVisible (false );
144143
145- // Checkboxes for the libraries..
146- const QString applicationFilePath = QCoreApplication::applicationFilePath ();
147- const QString appPath = QFileInfo (applicationFilePath).canonicalPath ();
148- const QString datadir = getDataDir ();
149- QStringList searchPaths;
150- searchPaths << appPath << appPath + " /cfg" << inf.canonicalPath ();
151- #ifdef FILESDIR
152- if (FILESDIR[0 ])
153- searchPaths << FILESDIR << FILESDIR " /cfg" ;
154- #endif
155- if (!datadir.isEmpty ())
156- searchPaths << datadir << datadir + " /cfg" ;
157144 QStringList libs;
158145 // Search the std.cfg first since other libraries could depend on it
159146 QString stdLibraryFilename;
160- for (const QString &sp : searchPaths ) {
147+ for (const QString &sp : projectFile-> getSearchPaths ( " cfg " ) ) {
161148 QDir dir (sp);
162149 dir.setSorting (QDir::Name);
163150 dir.setNameFilters (QStringList (" *.cfg" ));
@@ -179,7 +166,7 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWi
179166 break ;
180167 }
181168 // Search other libraries
182- for (const QString &sp : searchPaths ) {
169+ for (const QString &sp : projectFile-> getSearchPaths ( " cfg " ) ) {
183170 QDir dir (sp);
184171 dir.setSorting (QDir::Name);
185172 dir.setNameFilters (QStringList (" *.cfg" ));
@@ -218,22 +205,15 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWi
218205 for (const Platform::Type builtinPlatform : builtinPlatforms)
219206 mUI ->mComboBoxPlatform ->addItem (platforms.get (builtinPlatform).mTitle );
220207 QStringList platformFiles;
221- for (QString sp : searchPaths) {
222- if (sp.endsWith (" /cfg" ))
223- sp = sp.mid (0 ,sp.length ()-3 ) + " platforms" ;
208+ for (const QString& sp : projectFile->getSearchPaths (" platforms" )) {
224209 QDir dir (sp);
225210 dir.setSorting (QDir::Name);
226211 dir.setNameFilters (QStringList (" *.xml" ));
227212 dir.setFilter (QDir::Files | QDir::NoDotAndDotDot);
228213 for (const QFileInfo& item : dir.entryInfoList ()) {
229214 const QString platformFile = item.fileName ();
230-
231- const std::vector<std::string> paths = {
232- Path::getCurrentPath (), // TODO: do we want to look in CWD?
233- applicationFilePath.toStdString (),
234- };
235215 Platform plat2;
236- if (!plat2.loadFromFile (paths , platformFile.toStdString ()))
216+ if (!plat2.loadFromFile ({sp. toStdString ()} , platformFile.toStdString ()))
237217 continue ;
238218
239219 if (platformFiles.indexOf (platformFile) == -1 )
0 commit comments