diff dep/animia/src/animia.cc @ 148:aa4df5a84338

dep/animia: use std::pair instead of std::tuple
author Paper <mrpapersonic@gmail.com>
date Tue, 14 Nov 2023 13:27:13 -0500
parents d8a61e7e2a36
children 8700806c2cc2
line wrap: on
line diff
--- a/dep/animia/src/animia.cc	Tue Nov 14 13:19:40 2023 -0500
+++ b/dep/animia/src/animia.cc	Tue Nov 14 13:27:13 2023 -0500
@@ -9,10 +9,17 @@
 
 namespace animia {
 
-static bool ProcessInPlayers(const std::vector<Player>& players, const std::string& name, Player& player_) {
+static bool ProcessInPlayers(const std::vector<Player>& players, std::string name, Player& player_) {
 	for (const auto& player : players) {
 		for (const auto& exe : player.executables) {
-			if (exe == name.substr(0, name.rfind(".exe"))) {
+			/* this is only really relevant on Windows, and even then
+			   executables can end in any number of extensions, so we should
+			   really remove them all... */
+			auto pos = name.rfind(".exe");
+			if (pos != std::string::npos)
+				name = name.substr(0, pos);
+
+			if (exe == name) {
 				player_ = player;
 				return true;
 			}