File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 1111
1212#include < algorithm>
1313#include < exception>
14+ #include < filesystem>
1415#include < spdlog/spdlog.h>
1516
1617
@@ -120,13 +121,17 @@ void input::JoyStickInputManager::discover_devices(std::vector<std::unique_ptr<I
120121
121122 const auto mappings_file = utils::get_assets_folder () / " mappings" / " gamecontrollerdb.txt" ;
122123
123- const auto mapped_number = SDL_GameControllerAddMappingsFromFile (mappings_file.string ().c_str ());
124-
125- if (mapped_number < 0 ) {
126- // this is just a warning, no need to abort here, since we just have less mappings
127- spdlog::warn (" Failed to add new Controller mappings: {}" , SDL_GetError ());
124+ if (not std::filesystem::exists (mappings_file)) {
125+ spdlog::warn (" Mappings file doesn't exist: {}" , mappings_file.string ());
128126 } else {
129- spdlog::debug (" Added {} new Controller mappings!" , mapped_number);
127+ const auto mapped_number = SDL_GameControllerAddMappingsFromFile (mappings_file.string ().c_str ());
128+
129+ if (mapped_number < 0 ) {
130+ // this is just a warning, no need to abort here, since we just have less mappings
131+ spdlog::warn (" Failed to add new Controller mappings: {}" , SDL_GetError ());
132+ } else {
133+ spdlog::debug (" Added {} new Controller mappings!" , mapped_number);
134+ }
130135 }
131136
132137
You can’t perform that action at this time.
0 commit comments