revZip functions, compressing and extracting folder for transfer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

revZip functions, compressing and extracting folder for transfer

Rick Harrison via use-livecode
Is there an overview or tutorial on how to use the revZip functions?

Do I have to use each individual function to manually describe the process
of creating and using a zip archive?

Like, to create the archive, do I have to write my own code to open it,
repeat for each file and/or each folder, find and specify the name and
contents and format of each file, then close it, then remember to delete it
later...or is there a command somewhere that just takes a folder and
returns a zipped version of that folder?

The same question for extracting an archive. Do I have to open it,
enumerate the files, repeat for each file and/or folder, figure out that
file's name, contents, and format, copy the file to an appropriate new
file, then close it, then remember to delete it later...or is there a
command that just takes a *.zip and returns an extracted folder?

I already spent a couple hours trying various combinations of quotes around
the parameters to add something to an archive before I figured out put the
data into the URL as a binfile manually. Then this morning I ran across a
different revZip function to add a file directly, instead of raw data,
which I guess is what I was doing. So it would be nice to find out that
there's already a function that does all of the obvious zip archive stuff
automatically and correctly.
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: revZip functions, compressing and extracting folder for transfer

Rick Harrison via use-livecode
On 3/4/17 11:25 AM, Matt Maier via use-livecode wrote:
> Is there an overview or tutorial on how to use the revZip functions?

Under the Help menu, choose Sample Stacks and search for "revZip". There
are a couple of stacks there. Also under the Help menu, choose
Tutorials. There is one lesson on using revZip.

I think there used to be a sample stack included inside the Mac app
bundle, or inside the Windows app folder, but I don't see it now in LC
9. It may be in an older version.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: revZip functions, compressing and extracting folder for transfer

Rick Harrison via use-livecode
In reply to this post by Rick Harrison via use-livecode
Here is a sanitized version of a simple zip library stack I use in
projects. It keeps me from having to get down into the nuts and bolts
every time I want to zip a file:

    https://www.dropbox.com/s/t8z27p8cy5ir1v9/libZip.livecode?dl=0

HTH -
Phil Davis


On 3/4/17 9:25 AM, Matt Maier via use-livecode wrote:

> Is there an overview or tutorial on how to use the revZip functions?
>
> Do I have to use each individual function to manually describe the process
> of creating and using a zip archive?
>
> Like, to create the archive, do I have to write my own code to open it,
> repeat for each file and/or each folder, find and specify the name and
> contents and format of each file, then close it, then remember to delete it
> later...or is there a command somewhere that just takes a folder and
> returns a zipped version of that folder?
>
> The same question for extracting an archive. Do I have to open it,
> enumerate the files, repeat for each file and/or folder, figure out that
> file's name, contents, and format, copy the file to an appropriate new
> file, then close it, then remember to delete it later...or is there a
> command that just takes a *.zip and returns an extracted folder?
>
> I already spent a couple hours trying various combinations of quotes around
> the parameters to add something to an archive before I figured out put the
> data into the URL as a binfile manually. Then this morning I ran across a
> different revZip function to add a file directly, instead of raw data,
> which I guess is what I was doing. So it would be nice to find out that
> there's already a function that does all of the obvious zip archive stuff
> automatically and correctly.
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

--
Phil Davis

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: revZip functions, compressing and extracting folder for transfer

Rick Harrison via use-livecode
I pulled the zip archiving functions out of the Master Library stack.

It worked...except that it truncated the first character of every filename
in the archive.

This is the offending code from the addFolderToArchive handler:
put theFile into theArchiveItemName
put offset(pRootFolderPath, theArchiveItemName) into theCharNo
if theCharNo is 0 then return "file is not in expected folder"
delete char 1 to (the number of chars of pRootFolderPath + 1) of
theArchiveItemName # strip root folder up to slash (zip item names
shouldn't start with a slash)

The value I see for pRootFolderPath includes the ending slash, so the "+ 1"
here is deleting the first character of the filename.

Can I just remove the "+ 1"? Will that make it work on Windows but fail on
another system?

On Sat, Mar 4, 2017 at 12:49 PM, Phil Davis via use-livecode <
[hidden email]> wrote:

> Here is a sanitized version of a simple zip library stack I use in
> projects. It keeps me from having to get down into the nuts and bolts every
> time I want to zip a file:
>
>    https://www.dropbox.com/s/t8z27p8cy5ir1v9/libZip.livecode?dl=0
>
> HTH -
> Phil Davis
>
>
>
> On 3/4/17 9:25 AM, Matt Maier via use-livecode wrote:
>
>> Is there an overview or tutorial on how to use the revZip functions?
>>
>> Do I have to use each individual function to manually describe the process
>> of creating and using a zip archive?
>>
>> Like, to create the archive, do I have to write my own code to open it,
>> repeat for each file and/or each folder, find and specify the name and
>> contents and format of each file, then close it, then remember to delete
>> it
>> later...or is there a command somewhere that just takes a folder and
>> returns a zipped version of that folder?
>>
>> The same question for extracting an archive. Do I have to open it,
>> enumerate the files, repeat for each file and/or folder, figure out that
>> file's name, contents, and format, copy the file to an appropriate new
>> file, then close it, then remember to delete it later...or is there a
>> command that just takes a *.zip and returns an extracted folder?
>>
>> I already spent a couple hours trying various combinations of quotes
>> around
>> the parameters to add something to an archive before I figured out put the
>> data into the URL as a binfile manually. Then this morning I ran across a
>> different revZip function to add a file directly, instead of raw data,
>> which I guess is what I was doing. So it would be nice to find out that
>> there's already a function that does all of the obvious zip archive stuff
>> automatically and correctly.
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
> --
> Phil Davis
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode