AddPackEmptyDirs Crossplattform without API
Posted: Tue Feb 12, 2013 9:35 pm
The new PackerLibs supports directories for PackEntryType but there is no native function to add empty directories.
Here is a workaround for ZipPacker without using external lib!
Is not the biggest Code
, but i think this can be usefull
Have Fun
Here is a workaround for ZipPacker without using external lib!
Code: Select all
UseZipPacker()
Procedure AddPackEmptyDirs(ID, name.s)
If name <> ""
ReplaceString(name, "\", "/", #PB_String_InPlace)
If Right(name, 1) <> "/" : name + "/" : EndIf
ProcedureReturn AddPackMemory(ID, 0, 0, name)
EndIf
EndProcedure
CreatePack(0, GetTemporaryDirectory() + "test.zip")
AddPackEmptyDirs(0, "test")
AddPackEmptyDirs(0, "bla\blub\PB\")
ClosePack(0)
If OpenPack(0, GetTemporaryDirectory() + "test.zip")
If ExaminePack(0)
While NextPackEntry(0)
Debug PackEntryName(0)
Debug PackEntryType(0)
Debug "---------------"
Wend
EndIf
ClosePack(0)
EndIf


Have Fun