]> git.tdb.fi Git - libs/gui.git/commitdiff
Sort game controller devices for consistency
authorMikko Rasa <tdb@tdb.fi>
Thu, 6 Jun 2019 09:39:00 +0000 (12:39 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 6 Jun 2019 09:39:00 +0000 (12:39 +0300)
Directory order might change as devices are plugged in and removed.

source/input/linux/gamecontroller.cpp

index c00379d4c70e9e595c0c1257a7ac92881f574861..38d9d2b222901ab6d6fd69462035655f7efb4c77 100644 (file)
@@ -43,6 +43,7 @@ unsigned GameController::detect()
 
        FS::Path dev_input = "/dev/input";
        list<string> devices = FS::list_filtered(dev_input, "^js[0-9]+");
+       devices.sort();
        for(list<string>::const_iterator i=devices.begin(); i!=devices.end(); ++i)
                // TODO check permissions
                Private::detected_controllers.push_back((dev_input / *i).str());