check only for partial path

This commit is contained in:
PancakeTAS 2025-07-17 23:05:42 +02:00 committed by Pancake
parent bb976ea863
commit f62e658b11
2 changed files with 5 additions and 2 deletions

View file

@ -13,6 +13,7 @@
#include <unordered_map> #include <unordered_map>
#include <string_view> #include <string_view>
#include <filesystem> #include <filesystem>
#include <algorithm>
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
#include <iostream> #include <iostream>
@ -207,7 +208,9 @@ Configuration Config::getConfig(std::string_view name) {
return globalConf; return globalConf;
const auto& games = *gameConfs; const auto& games = *gameConfs;
auto it = games.find(std::string(name)); auto it = std::ranges::find_if(games, [&name](const auto& pair) {
return name.ends_with(pair.first);
});
if (it != games.end()) if (it != games.end())
return it->second; return it->second;

View file

@ -217,7 +217,7 @@ std::string Utils::getProcessName() {
if (exe_len <= 0) if (exe_len <= 0)
return "Unknown Process"; return "Unknown Process";
exe.at(static_cast<size_t>(exe_len)) = '\0'; exe.at(static_cast<size_t>(exe_len)) = '\0';
return{basename(exe.data())}; return{exe.data()};
} }
/// Get the config file /// Get the config file