@@ -137,7 +137,22 @@ struct CoTaskMemDeleter {
137137
138138} // namespace
139139
140- std::vector<std::string> SearchDataFiles (const std::string_view ext, const std::string_view subdir)
140+ auto SearchDataFiles (const std::string_view ext) -> std::vector<std::string>
141+ {
142+ auto srchlock = std::lock_guard{gSearchLock };
143+
144+ /* Search the app-local directory. */
145+ auto results = std::vector<std::string>{};
146+ if (auto localpath = al::getenv (L" ALSOFT_LOCAL_PATH" ))
147+ DirectorySearch (*localpath, ext, &results);
148+ else if (auto curpath = std::filesystem::current_path (); !curpath.empty ())
149+ DirectorySearch (curpath, ext, &results);
150+
151+ return results;
152+ }
153+
154+ auto SearchDataFiles (const std::string_view ext, const std::string_view subdir)
155+ -> std::vector<std::string>
141156{
142157 std::lock_guard<std::mutex> srchlock{gSearchLock };
143158
@@ -150,12 +165,6 @@ std::vector<std::string> SearchDataFiles(const std::string_view ext, const std::
150165 return results;
151166 }
152167
153- /* Search the app-local directory. */
154- if (auto localpath = al::getenv (L" ALSOFT_LOCAL_PATH" ))
155- DirectorySearch (*localpath, ext, &results);
156- else if (auto curpath = std::filesystem::current_path (); !curpath.empty ())
157- DirectorySearch (curpath, ext, &results);
158-
159168#if !defined(ALSOFT_UWP) && !defined(_GAMING_XBOX)
160169 /* Search the local and global data dirs. */
161170 for (const auto &folderid : std::array{FOLDERID_RoamingAppData, FOLDERID_ProgramData})
@@ -295,7 +304,22 @@ const PathNamePair &GetProcBinary()
295304 return procbin;
296305}
297306
298- std::vector<std::string> SearchDataFiles (const std::string_view ext, const std::string_view subdir)
307+ auto SearchDataFiles (const std::string_view ext) -> std::vector<std::string>
308+ {
309+ auto srchlock = std::lock_guard{gSearchLock };
310+
311+ /* Search the app-local directory. */
312+ auto results = std::vector<std::string>{};
313+ if (auto localpath = al::getenv (" ALSOFT_LOCAL_PATH" ))
314+ DirectorySearch (*localpath, ext, &results);
315+ else if (auto curpath = std::filesystem::current_path (); !curpath.empty ())
316+ DirectorySearch (curpath, ext, &results);
317+
318+ return results;
319+ }
320+
321+ auto SearchDataFiles (const std::string_view ext, const std::string_view subdir)
322+ -> std::vector<std::string>
299323{
300324 std::lock_guard<std::mutex> srchlock{gSearchLock };
301325
@@ -307,12 +331,6 @@ std::vector<std::string> SearchDataFiles(const std::string_view ext, const std::
307331 return results;
308332 }
309333
310- /* Search the app-local directory. */
311- if (auto localpath = al::getenv (" ALSOFT_LOCAL_PATH" ))
312- DirectorySearch (*localpath, ext, &results);
313- else if (auto curpath = std::filesystem::current_path (); !curpath.empty ())
314- DirectorySearch (curpath, ext, &results);
315-
316334 /* Search local data dir */
317335 if (auto datapath = al::getenv (" XDG_DATA_HOME" ))
318336 DirectorySearch (std::filesystem::path{*datapath}/path, ext, &results);
0 commit comments