Mac: Fix makepath bugs introduced in cea5148

This commit is contained in:
Michael Buckley 2023-03-25 13:54:13 -07:00
parent 2e568452c0
commit 7d37196f72

View File

@ -295,14 +295,14 @@ const char * S9xGetFilename (const char *inExt, enum s9x_getdirtype dirtype)
{ {
auto path = splitpath(Memory.ROMFilename); auto path = splitpath(Memory.ROMFilename);
path.ext = inExt; path.ext = inExt;
makepath(path); strncpy(filePath[index], makepath(path).c_str(), PATH_MAX);
} }
} }
else else
{ {
auto path = splitpath(Memory.ROMFilename); auto path = splitpath(Memory.ROMFilename);
path.ext = inExt; path.ext = inExt;
makepath(path); strncpy(filePath[index], makepath(path).c_str(), PATH_MAX);
} }
return (filePath[index]); return (filePath[index]);
@ -421,11 +421,6 @@ std::string S9xGetDirectory (enum s9x_getdirtype dirtype)
} }
auto p = splitpath(S9xGetFilename(inExt, dirtype)); auto p = splitpath(S9xGetFilename(inExt, dirtype));
makepath(p.drive, p.drive, path[index], ""); strncpy(path[index], makepath(p.drive, p.dir, "", "").c_str(), PATH_MAX);
size_t l = strlen(path[index]);
if (l > 1)
path[index][l - 1] = 0;
return (path[index]); return (path[index]);
} }