[nostalgia/player] Fix loading from directory

This commit is contained in:
Gary Talent 2019-11-09 19:01:20 -06:00
parent 7d5595b405
commit e5a66e1160

View File

@ -65,7 +65,8 @@ int main(int argc, const char **argv) {
std::unique_ptr<ox::FileSystem> fs; std::unique_ptr<ox::FileSystem> fs;
std::vector<uint8_t> rom; std::vector<uint8_t> rom;
std::string path = argv[1]; std::string path = argv[1];
const std::string fsExt = path.substr(path.find_last_of('.')); const auto lastDot = path.find_last_of('.');
const std::string fsExt = lastDot != std::string::npos ? path.substr(lastDot) : "";
if (fsExt == ".oxfs") { if (fsExt == ".oxfs") {
rom = loadFileBuff(path.c_str()); rom = loadFileBuff(path.c_str());
if (!rom.size()) { if (!rom.size()) {