Merge pull request #5896 from bparker06/filepath

omit extra slash at end of path, Win95/98 doesn't like them
This commit is contained in:
Twinaphex 2017-12-09 23:30:46 +01:00 committed by GitHub
commit d82812a292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);