Fixed an issue that could hang the application when generating miximages.

This commit is contained in:
Leon Styhre 2021-06-09 20:38:34 +02:00
parent 19a2a9d964
commit c9cd282b7f

View file

@ -811,21 +811,20 @@ void MiximageGenerator::convertFromCImgFormat(CImg<unsigned char> image,
std::string MiximageGenerator::getSavePath() std::string MiximageGenerator::getSavePath()
{ {
const std::string systemsubdirectory = mGame->getSystem()->getName();
const std::string name = Utils::FileSystem::getStem(mGame->getPath()); const std::string name = Utils::FileSystem::getStem(mGame->getPath());
std::string subFolders; std::string subFolders;
// Extract possible subfolders from the path. // Extract possible subfolders from the path.
if (mGame->getSystemEnvData()->mStartPath != "") if (mGame->getSystemEnvData()->mStartPath != "")
subFolders = Utils::String::replace(Utils::FileSystem::getParent(mGame->getPath()), subFolders = Utils::String::replace(Utils::FileSystem::getParent(mGame->getPath()),
mGame->getSystem()->getSystemEnvData()->mStartPath, ""); mGame->getSystemEnvData()->mStartPath, "");
std::string path = FileData::getMediaDirectory(); std::string path = FileData::getMediaDirectory();
if (!Utils::FileSystem::exists(path)) if (!Utils::FileSystem::exists(path))
Utils::FileSystem::createDirectory(path); Utils::FileSystem::createDirectory(path);
path += systemsubdirectory + "/miximages" + subFolders + "/"; path += mGame->getSystemName() + "/miximages" + subFolders + "/";
if (!Utils::FileSystem::exists(path)) if (!Utils::FileSystem::exists(path))
Utils::FileSystem::createDirectory(path); Utils::FileSystem::createDirectory(path);