diff --git a/src/86box.c b/src/86box.c index 696f65a5d..3a9b199c0 100644 --- a/src/86box.c +++ b/src/86box.c @@ -395,12 +395,12 @@ pc_log(const char *fmt, ...) int pc_init(int argc, char *argv[]) { - char path[2048], path2[2048]; + char *ppath = NULL, *rpath = NULL; char *cfg = NULL, *p; #if !defined(__APPLE__) && !defined(_WIN32) char *appimage; #endif - char temp[128]; + char temp[2048]; struct tm *info; time_t now; int c, vmrp = 0; @@ -424,9 +424,6 @@ pc_init(int argc, char *argv[]) plat_getcwd(usr_path, sizeof(usr_path) - 1); plat_getcwd(rom_path, sizeof(rom_path) - 1); - memset(path, 0x00, sizeof(path)); - memset(path2, 0x00, sizeof(path)); - for (c=1; cnext != NULL) { - rom_path = rom_path->next; - } - // Allocate the new entry. - rom_path = rom_path->next = calloc(1, sizeof(rom_path_t)); + if (rom_paths.path[0] != '\0') + { + // Iterate to the end of the list. + while (rom_path->next != NULL) { + rom_path = rom_path->next; + } + + // Allocate the new entry. + rom_path = rom_path->next = calloc(1, sizeof(rom_path_t)); + } // Save the path, turning it into absolute if needed. if (!plat_path_abs((char*) path)) {