work with zip

Discuss about plugins that don't have a dedicated forum
Post Reply
sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

work with zip

Post by sashapont »

I have zip archive with folders.
How I can get idx for file in folder like?

Code: Select all

zip.OpenArchive(1, "my.zip")
 idx = zip.LocateFile(1, "images/zip.png")

User avatar
airsoftsoftwair
Posts: 4386
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: work with zip

Post by airsoftsoftwair »

Exactly like this. Doesn't it work?

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Post by sashapont »

it is not work fщr me :(

I want delete file which located in directory from zip archive,
First I try to find idx, I always have -1

User avatar
airsoftsoftwair
Posts: 4386
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: work with zip

Post by airsoftsoftwair »

Is the spelling correct? zip.LocateFile() is case sensitive by default. If it still doesn't work, upload the zip archive and your code and I'll check what's wrong there.

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Post by sashapont »

It doesn't work :(

Code: Select all


@DISPLAY 1, {Width=1280, Height=720, Color=$ececec, Sizeable = True, ScaleMode=#SCALEMODE_AUTO, ScreenName="myzip"}

@REQUIRE "zip"

Function p_File_Open()
presentationname="/Volumes/MacHD2/Downloads/Newzip/1/my.zip"

zip.OpenArchive(1, presentationname)

idx = zip.LocateFile(1, "/Images/2.jpg")
DebugPrint("idx"..idx)

;  zip.DeleteFile(presentationname, idx)
EndFunction

p_File_Open()

; Main Program Loop *******************************************************************************
Repeat
    WaitEvent
Forever     
Zip file
https://cloud.mail.ru/public/2Qwd/KP45LHffN

User avatar
airsoftsoftwair
Posts: 4386
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: work with zip

Post by airsoftsoftwair »

Well, you're using "/Images/2.jpg" but you should be using "Images/2.jpg"... then it will work.

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Post by sashapont »

Thank you! It is work!

But sometimes deleted files there are in zip with 0 size.

User avatar
airsoftsoftwair
Posts: 4386
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: work with zip

Post by airsoftsoftwair »

Please provide demo code.

sashapont
Posts: 144
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Post by sashapont »

I don't change code. I only delete slash

User avatar
airsoftsoftwair
Posts: 4386
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: work with zip

Post by airsoftsoftwair »

So what is the problem? The code you posted has zip.DeleteFile() disabled and it also doesn't open the archive for #MODE_READWRITE so deleting anything won't work. You need to explain what the problem is... otherwise I can't help you.

Post Reply