File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -727,12 +727,22 @@ static int menu_displaylist_parse_core_info(
727727 strlcpy(tmp_path, path_get(RARCH_PATH_CONTENT), sizeof(tmp_path));
728728 path_basedir(tmp_path);
729729
730- /* Removes trailing slash, doesn't really matter but it's more consistent with how
731- * the path is stored and displayed without 'System Files are in Content Directory' */
732- len = strlen(tmp_path);
733- if (tmp_path[len - 1] == PATH_DEFAULT_SLASH_C())
734- tmp_path[len - 1] = '\0';
735- firmware_info.directory.system = tmp_path;
730+ /* If content path is empty, fall back to global system dir path */
731+ if (string_is_empty(tmp_path))
732+ firmware_info.directory.system = settings->paths.directory_system;
733+ else
734+ {
735+ size_t len = strlen(tmp_path);
736+
737+ /* Removes trailing slash (unless root dir), doesn't really matter
738+ * but it's more consistent with how the path is stored and
739+ * displayed without 'System Files are in Content Directory' */
740+ if ( string_count_occurrences_single_character(tmp_path, PATH_DEFAULT_SLASH_C()) > 1
741+ && tmp_path[len - 1] == PATH_DEFAULT_SLASH_C())
742+ tmp_path[len - 1] = '\0';
743+
744+ firmware_info.directory.system = tmp_path;
745+ }
736746 }
737747 else
738748 firmware_info.directory.system = settings->paths.directory_system;
Original file line number Diff line number Diff line change @@ -1981,15 +1981,18 @@ bool runloop_environment_cb(unsigned cmd, void *data)
19811981 strlcpy (tmp_path , fullpath , sizeof (tmp_path ));
19821982 path_basedir (tmp_path );
19831983
1984- /* Removes trailing slash */
1984+ /* Removes trailing slash (unless root dir) */
19851985 len = strlen (tmp_path );
1986- if (tmp_path [len - 1 ] == PATH_DEFAULT_SLASH_C ())
1986+ if ( string_count_occurrences_single_character (tmp_path , PATH_DEFAULT_SLASH_C ()) > 1
1987+ && tmp_path [len - 1 ] == PATH_DEFAULT_SLASH_C ())
19871988 tmp_path [len - 1 ] = '\0' ;
19881989
19891990 dir_set (RARCH_DIR_SYSTEM , tmp_path );
1991+ * (const char * * )data = dir_get_ptr (RARCH_DIR_SYSTEM );
19901992 }
1993+ else /* If content path is empty, fall back to global system dir path */
1994+ * (const char * * )data = dir_system ;
19911995
1992- * (const char * * )data = dir_get_ptr (RARCH_DIR_SYSTEM );
19931996 RARCH_LOG ("[Environ]: SYSTEM_DIRECTORY: \"%s\".\n" ,
19941997 * (const char * * )data );
19951998 }
You can’t perform that action at this time.
0 commit comments