work with zip

General questions that have to do with plugins go here

work with zip

Postby sashapont » Mon Dec 25, 2017 8:51 pm

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")
sashapont
 
Posts: 59
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Postby airsoftsoftwair » Tue Dec 26, 2017 9:21 pm

Exactly like this. Doesn't it work?
User avatar
airsoftsoftwair
 
Posts: 2445
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: work with zip

Postby sashapont » Tue Dec 26, 2017 10:19 pm

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
sashapont
 
Posts: 59
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Postby airsoftsoftwair » Wed Dec 27, 2017 12:05 am

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.
User avatar
airsoftsoftwair
 
Posts: 2445
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: work with zip

Postby sashapont » Wed Dec 27, 2017 9:38 pm

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
sashapont
 
Posts: 59
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Postby airsoftsoftwair » Thu Dec 28, 2017 12:43 pm

Well, you're using "/Images/2.jpg" but you should be using "Images/2.jpg"... then it will work.
User avatar
airsoftsoftwair
 
Posts: 2445
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: work with zip

Postby sashapont » Thu Dec 28, 2017 4:47 pm

Thank you! It is work!

But sometimes deleted files there are in zip with 0 size.
sashapont
 
Posts: 59
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Postby airsoftsoftwair » Thu Dec 28, 2017 9:53 pm

Please provide demo code.
User avatar
airsoftsoftwair
 
Posts: 2445
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: work with zip

Postby sashapont » Thu Dec 28, 2017 10:00 pm

I don't change code. I only delete slash
sashapont
 
Posts: 59
Joined: Thu Aug 03, 2017 2:49 pm

Re: work with zip

Postby airsoftsoftwair » Fri Dec 29, 2017 12:41 pm

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.
User avatar
airsoftsoftwair
 
Posts: 2445
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany


Return to General plugin questions

Who is online

Users browsing this forum: No registered users and 2 guests