Browse Source

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

Sasha Szpakowski 2 years ago
parent
commit
f06d6c6281
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/modules/joystick/sdl/Joystick.cpp

+ 3 - 1
src/modules/joystick/sdl/Joystick.cpp

@@ -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;
 }