mirror of https://github.com/snes9xgit/snes9x.git
gtk, unix: fixes to unbreak build and loading ROMs
This commit is contained in:
parent
7455501db8
commit
4080eef6a7
|
@ -33,7 +33,8 @@ _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext)
|
||||||
char *slash = strrchr ((char *) path, SLASH_CHAR);
|
char *slash = strrchr ((char *) path, SLASH_CHAR);
|
||||||
char *dot = strrchr ((char *) path, '.');
|
char *dot = strrchr ((char *) path, '.');
|
||||||
|
|
||||||
*drive = '\0';
|
if (drive)
|
||||||
|
*drive = '\0';
|
||||||
|
|
||||||
if (dot && slash && dot < slash)
|
if (dot && slash && dot < slash)
|
||||||
{
|
{
|
||||||
|
@ -42,33 +43,44 @@ _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext)
|
||||||
|
|
||||||
if (!slash)
|
if (!slash)
|
||||||
{
|
{
|
||||||
*dir = '\0';
|
if (dir)
|
||||||
strcpy (fname, path);
|
*dir = '\0';
|
||||||
|
if (fname)
|
||||||
|
strcpy (fname, path);
|
||||||
|
|
||||||
if (dot)
|
if (dot)
|
||||||
{
|
{
|
||||||
fname[dot - path] = '\0';
|
if (fname)
|
||||||
strcpy (ext, dot + 1);
|
fname[dot - path] = '\0';
|
||||||
|
if (ext)
|
||||||
|
strcpy (ext, dot + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ext = '\0';
|
if (ext)
|
||||||
|
*ext = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy (dir, path);
|
if (dir) {
|
||||||
dir[slash - path] = '\0';
|
strcpy (dir, path);
|
||||||
strcpy (fname, slash + 1);
|
dir[slash - path] = '\0';
|
||||||
|
}
|
||||||
|
if (fname)
|
||||||
|
strcpy (fname, slash + 1);
|
||||||
|
|
||||||
if (dot)
|
if (dot)
|
||||||
{
|
{
|
||||||
fname[(dot - slash) - 1] = '\0';
|
if (fname)
|
||||||
strcpy (ext, dot + 1);
|
fname[(dot - slash) - 1] = '\0';
|
||||||
|
if (ext)
|
||||||
|
strcpy (ext, dot + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*ext = '\0';
|
if (ext)
|
||||||
|
*ext = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
msu1.cpp
2
msu1.cpp
|
@ -388,7 +388,7 @@ bool S9xMSU1ROMExists(void)
|
||||||
}
|
}
|
||||||
#ifdef UNZIP_SUPPORT
|
#ifdef UNZIP_SUPPORT
|
||||||
char ext[_MAX_EXT + 1];
|
char ext[_MAX_EXT + 1];
|
||||||
_splitpath(Memory.ROMFilename, nullptr, nullptr, nullptr, ext);
|
_splitpath(Memory.ROMFilename, NULL, NULL, NULL, ext);
|
||||||
if (!strcasecmp(ext, ".msu1"))
|
if (!strcasecmp(ext, ".msu1"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -354,7 +354,8 @@ static void ReadJoysticks (void);
|
||||||
|
|
||||||
void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext)
|
void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ext)
|
||||||
{
|
{
|
||||||
*drive = 0;
|
if (drive)
|
||||||
|
*drive = 0;
|
||||||
|
|
||||||
const char *slash = strrchr(path, SLASH_CHAR),
|
const char *slash = strrchr(path, SLASH_CHAR),
|
||||||
*dot = strrchr(path, '.');
|
*dot = strrchr(path, '.');
|
||||||
|
@ -364,31 +365,40 @@ void _splitpath (const char *path, char *drive, char *dir, char *fname, char *ex
|
||||||
|
|
||||||
if (!slash)
|
if (!slash)
|
||||||
{
|
{
|
||||||
*dir = 0;
|
if (dir)
|
||||||
|
*dir = 0;
|
||||||
|
|
||||||
strcpy(fname, path);
|
if (fname)
|
||||||
|
strcpy(fname, path);
|
||||||
|
|
||||||
if (dot)
|
if (dot)
|
||||||
{
|
{
|
||||||
fname[dot - path] = 0;
|
if (fname)
|
||||||
strcpy(ext, dot + 1);
|
fname[dot - path] = 0;
|
||||||
|
if (ext)
|
||||||
|
strcpy(ext, dot + 1);
|
||||||
}
|
}
|
||||||
else
|
else if (ext)
|
||||||
*ext = 0;
|
*ext = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy(dir, path);
|
if (dir) {
|
||||||
dir[slash - path] = 0;
|
strcpy(dir, path);
|
||||||
|
dir[slash - path] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(fname, slash + 1);
|
if (fname)
|
||||||
|
strcpy(fname, slash + 1);
|
||||||
|
|
||||||
if (dot)
|
if (dot)
|
||||||
{
|
{
|
||||||
fname[dot - slash - 1] = 0;
|
if (fname)
|
||||||
strcpy(ext, dot + 1);
|
fname[dot - slash - 1] = 0;
|
||||||
|
if (ext)
|
||||||
|
strcpy(ext, dot + 1);
|
||||||
}
|
}
|
||||||
else
|
else if (ext)
|
||||||
*ext = 0;
|
*ext = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue