I can call AddPackDirectory to add an empty directory, but I don't understand how to add files to that packed directory.
Any thoughts?
TIA,
Russ
AddPackDirectory question
Re: AddPackDirectory question
Ok, I fiddled around with it and figured it out.
Let's say you want to add a directory and then one file:
NewPack = CreatePack(#PB_Any,filename$,#PB_PackerPlugin_Zip) ; or whatever plugin you want to use
AddPackDirectory(NewPack,"PureBasic Projects") ; or whatever folder name you want
If you want to add a sub folder then:
AddPackDirectory(NewPack,"PureBasic Projects/MiscRoutines") ; so you have to build up the folder tree one by one
then
AddPackFile(NewPack,"c:\PureBasic Projects\MiscRoutines\MyRoutine.pb","PureBasic Projects/MiscRoutines/MyRoutine.pb")
It seems that the packer doesn't like the full path, meaning the drive letter x:\ and it also wants '/' instead of '\' for the packed name/path. Probably a unix thing. Perhaps someone more knowledgeable in this area can elaborate.
Let's say you want to add a directory and then one file:
NewPack = CreatePack(#PB_Any,filename$,#PB_PackerPlugin_Zip) ; or whatever plugin you want to use
AddPackDirectory(NewPack,"PureBasic Projects") ; or whatever folder name you want
If you want to add a sub folder then:
AddPackDirectory(NewPack,"PureBasic Projects/MiscRoutines") ; so you have to build up the folder tree one by one
then
AddPackFile(NewPack,"c:\PureBasic Projects\MiscRoutines\MyRoutine.pb","PureBasic Projects/MiscRoutines/MyRoutine.pb")
It seems that the packer doesn't like the full path, meaning the drive letter x:\ and it also wants '/' instead of '\' for the packed name/path. Probably a unix thing. Perhaps someone more knowledgeable in this area can elaborate.
Re: AddPackDirectory question
RSrole wrote: It seems that the packer doesn't like the full path, meaning the drive letter x:\ and it also wants '/' instead of '\' for the packed name/path. Probably a unix thing. Perhaps someone more knowledgeable in this area can elaborate.
Code: Select all
UseZipPacker()
zipfile.s=GetTemporaryDirectory()+"temp.zip"
SourceDir.s=#PB_Compiler_Home+"Examples\Sources\Data\"
zp = CreatePack(#PB_Any, zipfile)
If zp
AddPackFile(zp,SourceDir+"AlphaChannel.bmp","AlphaChannel.bmp") ; Root
AddPackFile(zp,SourceDir+"Background.bmp","Temp\Background.bmp") ; Unexisting path
AddPackDirectory(zp,"Temp\Temp")
AddPackFile(zp,#PB_Compiler_Home+"Examples\Sources\Data\PureBasic.bmp","Temp\Temp\PureBasic.bmp") ; Just created path
ClosePack(zp)
EndIf
If my English syntax and lexicon are incorrect, please bear with Google translate and DeepL. They rarely agree with each other!
Except on this sentence...
Except on this sentence...
Re: AddPackDirectory question
Yes, you are right. It doesn't like the drive letter part of things.
Thanks
Thanks

