$OpenBSD: patch-Src_main_cpp,v 1.2 2010/06/30 22:25:57 jakemsr Exp $ --- Src/main.cpp.orig Wed Jan 2 13:19:06 2002 +++ Src/main.cpp Thu Jan 14 08:50:09 2010 @@ -36,7 +36,7 @@ char AppDirPath[1024]; // Path of application director */ #ifndef __PSXOS__ -bool Frodo::load_rom_files(void) +bool Frodo::do_load_rom_files(void) { FILE *file; @@ -89,6 +89,28 @@ bool Frodo::load_rom_files(void) } return true; +} + +bool Frodo::load_rom_files(void) +{ + int fd = open(".", O_RDONLY); + + if (fd == -1) { + ShowRequester("Can't lock current directory", "Quit"); + return false; + } + + char *d = getenv("FRODOLIBDIR"); + if (d == NULL) + d = FRODOLIBDIR; + if (chdir(d) != 0) { + ShowRequester("Can't access Frodo Lib Directory", "Quit"); + return false; + } + bool result = do_load_rom_files(); + fchdir(fd); + close(fd); + return result; } #endif