Advertising
- Etwas
- Sunday, July 15th, 2007 at 4:04:20am MDT
- int UnzipFile(wxString src, wxString destdir, bool isInstall)
- {
- +
- wxZipEntryPtr entry;
- wxString in_str, progress_msg, buf;
- int errnum = 0, curfile = 0, totalfiles = 0;
- @@ -321,8 +324,12 @@
- (entry.reset(in_zip->GetNextEntry()), entry.get() != NULL) )
- {
- +
- curfile++;
- wxString name = entry->GetName();
- + in_str = destdir + wxT("" PATH_SEP) + name;
- +
- + // set progress
- progress_msg = wxT("Unpacking ") + name;
- if (! progress->Update(curfile, progress_msg) ) {
- MESG_DIALOG(wxT("Unpacking cancelled by user"));
- @@ -330,20 +337,25 @@
- break;
- }
- - in_str = destdir + wxT("" PATH_SEP) + name;
- + //check if the dir of the filename exists
- + if(!wxDirExists(wxPathOnly(in_str)))
- + {
- + if (! wxMkdir(in_str, 0777) )
- + {
- + buf = wxT("Unable to create directory ") + in_str;
- + errnum = 100;
- + break;
- + }
- + }
- - if (entry->IsDir() ) {
- - if (!wxDirExists(in_str) ) {
- - if (! wxMkdir(in_str, 0777) ) {
- - buf = wxT("Unable to create directory ") + in_str;
- - errnum = 100;
- - break;
- - }
- - }
- + // if it is a dir, only log it
- + if (entry->IsDir() )
- + {
- log->WriteFile(name, true); // Directory
- continue;
- }
- + // its a file, copy it
- wxFFileOutputStream* out = new wxFFileOutputStream(in_str);
- if (! out->IsOk() )
- {
- @@ -389,6 +401,7 @@
- if (log) delete log;
- wxLogVerbose(wxT("=== end UnzipFile"));
- return(errnum);
- +
- }
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.