From a910d48d684e0297604f57710c737b70ed84908b Mon Sep 17 00:00:00 2001 From: teuf <> Date: Mon, 30 Apr 2001 20:16:25 +0000 Subject: [PATCH] Fixed loading of zipped roms from the command line in the Linux version --- zsnes/src/zip/zzip.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/zsnes/src/zip/zzip.c b/zsnes/src/zip/zzip.c index bcd86d24..3fc6f7d4 100644 --- a/zsnes/src/zip/zzip.c +++ b/zsnes/src/zip/zzip.c @@ -24,6 +24,7 @@ #include #include #include +#include #endif #include #include @@ -300,14 +301,27 @@ int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite) void extractzip(char *FileToExtract) { 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) { - ZipError=1; - return; + ZipError=1; + return; } - ZipError=0; - do_extract(uf,0,0); + ZipError=0; + do_extract(uf,0,0); }