Only add platform field to love.joystick.getGamepadMappingString's result if it's not there already.

This commit is contained in:
Sasha Szpakowski
2023-06-17 20:33:59 -03:00
parent e559fd5e68
commit f06d6c6281
+3 -1
View File
@@ -323,7 +323,9 @@ std::string Joystick::getGamepadMappingString() const
// Matches SDL_GameControllerAddMappingsFromRW.
if (mappingstr.find_last_of(',') != mappingstr.length() - 1)
mappingstr += ",";
mappingstr += "platform:" + std::string(SDL_GetPlatform());
if (mappingstr.find("platform:") == std::string::npos)
mappingstr += "platform:" + std::string(SDL_GetPlatform());
return mappingstr;
}