Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » plugin/zip
plugin/zip [message #13797] Sun, 27 January 2008 23:32 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
...a new package to handle .zip files:

#include <plugin/zip/zip.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
	String outdir = "e:\\zipout";
	FileUnZip unzip("d:/uppsrc.zip");
	while(unzip) {
		String fn = AppendFileName(outdir, unzip.GetPath());
		if(unzip.IsFolder()) {
			RealizeDirectory(fn);
			unzip.SkipFile();
		}
		else {
			RealizePath(fn);
			FileOut out(fn);
			unzip.ReadFile(out);
		}
	}
	if(unzip.IsError())
		LOG("Error!");

	{
		FindFile ff("e:/zipout/uppsrc/CtrlLib/*.*");
		FileZip zip("e:/test.zip");
		while(ff) {
			if(ff.IsFile())
				zip.WriteFile(LoadFile(AppendFileName("e:/zipout/uppsrc/CtrlLib", ff.GetName())),
				              ff.GetName());
			ff.Next();
		}
	}
}


In the process, I have also refactored the code in Core/z.h and z.cpp.

Mirek

[Updated on: Sun, 27 January 2008 23:33]

Report message to a moderator

Re: plugin/zip [message #14845 is a reply to message #13797] Mon, 17 March 2008 22:08 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
How can we append to an existing zip file?
Re: plugin/zip [message #14849 is a reply to message #14845] Tue, 18 March 2008 00:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
captainc wrote on Mon, 17 March 2008 17:08

How can we append to an existing zip file?


Unzip / zip? Smile

Mirek
Re: plugin/zip [message #14930 is a reply to message #14849] Thu, 20 March 2008 18:11 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
So we would have to unzip the whole thing and then rezip with the new content? hmm, that could get a little resource intensive...

Can you point me to the zip specification you used? Maybe I can code up something that appends to the zip files.

[Updated on: Thu, 20 March 2008 18:44]

Report message to a moderator

Re: plugin/zip [message #14936 is a reply to message #14930] Thu, 20 March 2008 19:39 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
E.g.:

http://www.winimage.com/zLibDll/minizip.html

Previous Topic: Improved heap diagnostics
Next Topic: TheIDE now has "Lock link mode" flag in Build methods....
Goto Forum:
  


Current Time: Fri Apr 19 03:29:49 CEST 2024

Total time taken to generate the page: 0.04119 seconds