[Workspaces] Fix snapping Discord (#34602)

This commit is contained in:
Seraphima Zykova 2024-09-05 12:08:24 +02:00 committed by GitHub
parent afc469c7ab
commit 43654a32b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -238,6 +238,23 @@ namespace Utils
}
}
// try by name if path not found
// apps list could contain a different path from that one we get from the process (for electron)
std::wstring exeName = std::filesystem::path(appPath).stem();
std::wstring exeNameUpper(exeName);
std::transform(exeNameUpper.begin(), exeNameUpper.end(), exeNameUpper.begin(), towupper);
for (const auto& appData : apps)
{
std::wstring appNameUpper(appData.name);
std::transform(appNameUpper.begin(), appNameUpper.end(), appNameUpper.begin(), towupper);
if (appNameUpper == exeNameUpper)
{
return appData;
}
}
return AppData{
.installPath = appPath
};