Page 1 of 1

7zip archive for mozilla extension

Posted: Mon Jul 10, 2006 8:52 am
by oryaaaaa
Code updated For 5.20+

I was not able to use PureZip to open Jar of Extension.
I do not understand the way though I want to make the library.
This is forcible Tips.

Thank you

Use usage - Easy Extension Editor (Alpha)
http://forum.oryaaaaa.com/viewtopic.php?t=140

Code: Select all

DataSection
  zip:
  ;     IncludeBinary "7za.exe"
  zip_e:
EndDataSection

Enumeration
  #SevenZip_Archive
  #SevenZip_Archive_jar
  #SevenZip_Extract
EndEnumeration

Procedure.b SevenZip(Mode, ArchiveFile.s, TargetDirectory.s)
  Protected file.l , cmdpath.s , zip_Run.l , zip_Outstr.s, runfile.s ; , WinTitle.s

  
  If Mode=#SevenZip_Archive
    cmdpath.s = "a -tzip "+Chr(34)+ArchiveFile+Chr(34)+" -r -mx=9 "+Chr(34)+TargetDirectory+"\*.*"+Chr(34)
    runfile.s =GetPathPart( ArchiveFile )+"7za.exe"
  ElseIf Mode=#SevenZip_Archive_jar
    cmdpath.s = "a -tzip "+Chr(34)+ArchiveFile+Chr(34)+" -r -mx=0 "+Chr(34)+TargetDirectory+"\*.*"+Chr(34)
    runfile.s =GetPathPart( ArchiveFile )+"7za.exe"
  ElseIf Mode=#SevenZip_Extract
    cmdpath.s = "x "+Chr(34)+ArchiveFile+Chr(34)+" -y"
    runfile.s = TargetDirectory+"\7za.exe"
  Else
    ProcedureReturn #False
  EndIf
  file.l = CreateFile(#PB_Any, runfile)
  If file
    WriteData(file, ?zip, ?zip_e-?zip)
    CloseFile(file)
    zip_Run = RunProgram(runfile, cmdpath,TargetDirectory, #PB_Program_Open| #PB_Program_Hide |#PB_Program_Read) 
    ;WinTitle.s=GetWindowTitle(#Window_okiraku)
    While ProgramRunning(zip_Run)
      ; WindowEvent() :Delay(1)
      zip_Outstr =ReadProgramString(zip_Run)
      ; SetWindowTitle(#Window_okiraku, WinTitle+Space(3)+zip_Outstr )
    Wend
    DeleteFile(runfile)
    ProcedureReturn #True 
  Else
    ProcedureReturn #False
  EndIf
EndProcedure

SevenZip(#SevenZip_Archive, "C:\test.zip" ,"C:\Program Files\PureBasic")
CreateDirectory("C:\Basic")
SevenZip(#SevenZip_Extract, "C:\test.zip" ,"C:\Basic")
DeleteFile("C:\test.zip")
End

Re: 7zip archive for mozilla extension

Posted: Mon Jul 10, 2006 9:23 am
by gnozal
oryaaaaa wrote:I was not able to use PureZip to open Jar of Extension.
Strange. To my knowledge, .JAR files are simpy .ZIP files with another extension.
I have tested several .JAR files with PureZIP without a problem.
Could you send me such a .JAR file ?

Posted: Mon Jul 10, 2006 12:20 pm
by oryaaaaa
Sorry, When it is not Open but Archive is done, Firefox cannot read.

Firefox reads and processes the right of access for UNIX that doesn't exist in Windows. And, the developer of FirefoxExtension uses 7zip. The most correct way of making is to set the right of access on Linux and to do ZIP. It is impossible in PureZIP.

Posted: Mon Jul 10, 2006 2:43 pm
by gnozal
oryaaaaa wrote:Sorry, When it is not Open but Archive is done, Firefox cannot read.

Firefox reads and processes the right of access for UNIX that doesn't exist in Windows. And, the developer of FirefoxExtension uses 7zip. The most correct way of making is to set the right of access on Linux and to do ZIP. It is impossible in PureZIP.
Ok, thanks.