Fixed loading of zipped roms from the command line in the Linux version

This commit is contained in:
teuf
2001-04-30 20:16:25 +00:00
parent 74e373ee44
commit a910d48d68

View File

@@ -24,6 +24,7 @@
#include <utime.h> #include <utime.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#endif #endif
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@@ -300,14 +301,27 @@ int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite)
void extractzip(char *FileToExtract) void extractzip(char *FileToExtract)
{ {
unzFile uf=NULL; unzFile uf=NULL;
uf = unzOpen(FileToExtract); // I really don't like hardcoding these sizes...
char oldpath[128];
#ifdef __LINUX__
extern char InitDir;
getcwd(oldpath, 128);
chdir(&InitDir);
#endif
uf = unzOpen(FileToExtract);
#ifdef __LINUX__
chdir(oldpath);
#endif
if (uf==NULL) if (uf==NULL)
{ {
ZipError=1; ZipError=1;
return; return;
} }
ZipError=0; ZipError=0;
do_extract(uf,0,0); do_extract(uf,0,0);
} }