C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Extracting relative paths

rated by 0 users
This post has 2 Replies | 0 Followers

Top 10 Contributor
Posts 89,785
newsgroup_archive Posted: Thu, Oct 20 2005 8:50 AM

Am I just missing something or can't the C1 Mobile Zip create the relative paths when extracting files? It slows down processing to have to check and create the directories before extracting the files. Thanks.

Click here to view the original newsgroup article (read only).

Top 10 Contributor
Posts 89,785
> Am I just missing something or can't the C1 Mobile Zip create the relative
> paths when extracting files? It slows down processing to have to check and
> create the directories before extracting the files. Thanks.

It really can't do that (at least not the current version).

But it would probably take the same amount of time for the component to do
it as it would for your app, so it seems like an ease-of-use/convenience
issue, not really performance related.


Click here to view the original newsgroup article (read only).

Top 10 Contributor
Posts 89,785
> It really can't do that (at least not the current version).

BTW, here's some code that does it in WinForms. I haven't tested this in the
compact framework, but it might worke there as well:

private void ExtractFolder(C1ZipFile zip, string path)
{
foreach (C1ZipEntry ze in zip.Entries)
{
string fn = ze.FileName;
string filePath = Path.Combine(path, Path.GetDirectoryName(fn));
string fileName = Path.GetFileName(fn);

if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
zip.Entries.Extract(ze.FileName, Path.Combine(filePath, fileName));
}
}


Click here to view the original newsgroup article (read only).

Page 1 of 1 (3 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.