From eafeb83d0b00149954d2a82c5c05164810fc692b Mon Sep 17 00:00:00 2001 From: jdgleaver Date: Mon, 28 Jun 2021 10:40:37 +0100 Subject: [PATCH] Fix archive delimiter detection when file path contains no slashes --- libretro-common/file/file_path.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 7be76d338f..3993bbaa34 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -87,8 +87,14 @@ const char *path_get_archive_delim(const char *path) buf[0] = '\0'; + /* We search for delimiters after the last slash + * in the file path to avoid capturing delimiter + * characters in any parent directory names. + * If there are no slashes in the file name, then + * the path is just the file basename - in this + * case we search the path in its entirety */ if (!last_slash) - return NULL; + last_slash = path; /* Find delimiter position * > Since filenames may contain '#' characters,