From: <pa...@us...> - 2003-10-11 22:17:59
|
Update of /cvsroot/fuse-emulator/fuse In directory sc8-pr-cvs1:/tmp/cvs-serv19574 Modified Files: machine.c utils.c Log Message: When looking for ROMs or library files, look in the roms/ or lib/ directory off where the Fuse executable is, not off the current directory. Index: machine.c =================================================================== RCS file: /cvsroot/fuse-emulator/fuse/machine.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** machine.c 6 Oct 2003 11:59:26 -0000 1.69 --- machine.c 11 Oct 2003 22:17:54 -0000 1.70 *************** *** 31,34 **** --- 31,35 ---- #include <stdio.h> #include <fcntl.h> + #include <libgen.h> #include <settings.h> #include <string.h> *************** *** 401,405 **** { int fd; ! char path[ PATHNAME_MAX_LENGTH ]; /* If this is an absolute path, just look there */ --- 402,407 ---- { int fd; ! char fuse_path[ PATHNAME_MAX_LENGTH], path[ PATHNAME_MAX_LENGTH ]; ! char *fuse_dir; /* If this is an absolute path, just look there */ *************** *** 410,416 **** fd = open( filename, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; ! /* Then in a 'roms' subdirectory (very useful when Fuse hasn't been ! installed into /usr/local or wherever) */ ! snprintf( path, PATHNAME_MAX_LENGTH, "roms/%s", filename ); fd = open( path, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; --- 412,422 ---- fd = open( filename, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; ! /* Then in a 'roms' subdirectory off where the Fuse executable is ! (useful when Fuse hasn't been installed into /usr/local or ! wherever) */ ! strncpy( fuse_path, fuse_progname, PATHNAME_MAX_LENGTH ); ! fuse_dir = dirname( fuse_path ); ! ! snprintf( path, PATHNAME_MAX_LENGTH, "%s/roms/%s", fuse_dir, filename ); fd = open( path, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; Index: utils.c =================================================================== RCS file: /cvsroot/fuse-emulator/fuse/utils.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** utils.c 8 Oct 2003 15:44:01 -0000 1.26 --- utils.c 11 Oct 2003 22:17:54 -0000 1.27 *************** *** 29,32 **** --- 29,33 ---- #include <errno.h> #include <fcntl.h> + #include <libgen.h> #include <stdio.h> #include <stdlib.h> *************** *** 167,180 **** } ! /* Find a ROM called `filename'; look in the current directory, ./roms ! and the defined roms directory; returns a fd for the ROM on success, ! -1 if it couldn't find the ROM */ int utils_find_lib( const char *filename ) { int fd; ! char path[ PATHNAME_MAX_LENGTH ]; ! snprintf( path, PATHNAME_MAX_LENGTH, "lib/%s", filename ); fd = open( path, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; --- 168,186 ---- } ! /* Find the auxillary file called `filename'; look in the lib ! directory below where the Fuse executable is and the defined ! package data directory; returns a fd for the ROM on success, -1 if ! it couldn't find the ROM */ int utils_find_lib( const char *filename ) { int fd; ! char fuse_path[ PATHNAME_MAX_LENGTH ], path[ PATHNAME_MAX_LENGTH ]; ! char *fuse_dir; ! strncpy( fuse_path, fuse_progname, PATHNAME_MAX_LENGTH ); ! fuse_dir = dirname( fuse_path ); ! ! snprintf( path, PATHNAME_MAX_LENGTH, "%s/lib/%s", fuse_dir, filename ); fd = open( path, O_RDONLY | O_BINARY ); if( fd != -1 ) return fd; |