Made the emulator wildcard support work on Windows.

This commit is contained in:
Leon Styhre 2022-02-21 19:14:41 +01:00
parent d8b99b1dff
commit a6b1a8844d

View file

@ -1455,9 +1455,16 @@ const std::string FileData::findEmulatorPath(std::string& command)
// Find the first matching file if a wildcard was used for the emulator entry.
if (path.find('*') != std::string::npos) {
#if defined(_WIN64)
Utils::FileSystem::StringList files {
Utils::FileSystem::getMatchingFiles(Utils::String::replace(path, "\\", "/"))};
if (files.size() > 0)
path = Utils::String::replace(files.front(), "/", "\\");
#else
Utils::FileSystem::StringList files {Utils::FileSystem::getMatchingFiles(path)};
if (files.size() > 0)
path = files.front();
#endif
}
if (Utils::FileSystem::isRegularFile(path) || Utils::FileSystem::isSymlink(path)) {