omit extra slash at end of path, Win95/98 doesn't like them

This commit is contained in:
Brad Parker 2017-12-09 16:38:33 -05:00
parent 812a99e5ca
commit 1a928b9c50

View File

@ -103,6 +103,7 @@ struct RDIR *retro_opendir(const char *name)
char path_buf[1024];
char *path_local = NULL;
wchar_t *path_wide = NULL;
unsigned path_len;
#endif
struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir));
@ -114,7 +115,13 @@ struct RDIR *retro_opendir(const char *name)
(void)path_local;
path_buf[0] = '\0';
snprintf(path_buf, sizeof(path_buf), "%s\\*", name);
path_len = strlen(name);
/* Non-NT platforms don't like extra slashes in the path */
if (name[path_len - 1] == '\\')
snprintf(path_buf, sizeof(path_buf), "%s*", name);
else
snprintf(path_buf, sizeof(path_buf), "%s\\*", name);
#if defined(LEGACY_WIN32)
path_local = utf8_to_local_string_alloc(path_buf);
rdir->directory = FindFirstFile(path_local, &rdir->entry);