Closed N7Alpha closed 2 years ago
Just get rid of tmp
and do:
{
/* Copy the game path */
loadPath = normalize_path(game->path);
+ gamePath = loadPath;
const size_t lastDot = loadPath.find_last_of('.');
- char tmp[PATH_MAX_LENGTH];
- snprintf(tmp, sizeof(tmp), "%s", game->path);
- gamePath = std::string(tmp);
Yeah that makes sense to me. I've updated the PR accordingly.
Thanks. Merged.
Just in case you didn't know, this core is a bit outdated (it's based on dosbox sources from 2020.) No active development is happening anymore other than some bugfixes (like this one). If possible, you should switch to DOSBox-core, which is maintained and up to date with upstream dosbox and has a lot of enhancements.
It looks like
gamePath
is assumed to already be normalized withnormalize_path
here. Without this change it isn't though.So the problem is if you pass a path like
"C:/program.exe"
toretro_load_game
on Windows whendir
is extracted it will equal"C:/program.exe"
instead of"C:/"
. This is becausestd::string::find_last_of
is looking for the Windows\
path separator and not the/
one. This would work as intended ifgamePath
was normalized though.