CatchPack

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

CatchPack

Post by User_Russian »

Propose to add the function CatchPack()
Result = CatchPack(#Pack, *Buffer, Size)
It is necessary, for example, if the Pack-file is in DataSection and includes all program resources (images, sounds, sprites, etc.).
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: CatchPack

Post by ts-soft »

+1

This is required for SFX (Self Extracting Files).
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: CatchPack

Post by User_Russian »

ts-soft wrote:This is required for SFX (Self Extracting Files).
I have just tried it and I have successfully managed to create a self-extracting archive of the code (slightly modified example from help).

Code: Select all

  UseZipPacker()
  
  ProgFile.s=ProgramFilename()
  Path.s=GetPathPart(ProgFile)
  
  ; Open the packed file
  If OpenPack(0, ProgramFilename()) 
    
    ; List all the entries
    If ExaminePack(0)
      While NextPackEntry(0)
        UncompressPackFile(0, PackEntryName(0))
      Wend
    EndIf
    
    ClosePack(0)
  EndIf
Create from the executable EXE-file.
Written at the end of the executable file, ready ZIP-archive.
At the end of the record the file size (number of bytes) in the form of long-variable.

You will have a self-extracting ZIP-archive.
Had just tried it and this method works.
BarryG
Addict
Addict
Posts: 3324
Joined: Thu Apr 18, 2019 8:17 am

Re: CatchPack

Post by BarryG »

User_Russian wrote: Fri Feb 08, 2013 7:14 pmadd the function CatchPack()
+1
Cyllceaux
Enthusiast
Enthusiast
Posts: 469
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: CatchPack

Post by Cyllceaux »

User_Russian wrote: Fri Feb 08, 2013 7:14 pm add the function CatchPack()
+1
GoodNPlenty
Enthusiast
Enthusiast
Posts: 108
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: CatchPack

Post by GoodNPlenty »

User_Russian wrote: ↑Fri Feb 08, 2013 11:14 am
add the function CatchPack()
+1
User avatar
Caronte3D
Addict
Addict
Posts: 1055
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: CatchPack

Post by Caronte3D »

+1
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: CatchPack

Post by davido »

+1
DE AA EB
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: CatchPack

Post by nsstudios »

This would be really useful.
+1
Quin
Enthusiast
Enthusiast
Posts: 322
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: CatchPack

Post by Quin »

+1
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
User avatar
idle
Always Here
Always Here
Posts: 5096
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: CatchPack

Post by idle »

Ezpack supports that
viewtopic.php?p=399040#p399040
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: CatchPack

Post by nsstudios »

:o
Thank you Idle, I've totally missed that!
Still, a native func would be nice, but this is awesome. Thank you for making that.
Quin
Enthusiast
Enthusiast
Posts: 322
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: CatchPack

Post by Quin »

Oh, that's epic! Agreed with nsstudios, a native Procedure to do this would be great, but this is awesome! Thanks a ton!
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
User avatar
idle
Always Here
Always Here
Posts: 5096
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: CatchPack

Post by idle »

Thanks nsstudio and quin, yes native would be good.
Post Reply