Remove zip file item path with Abbrevia

667 Views Asked by At

Is it possible to remove a zip file item's path with Abbrevia? After looking at the source code I can not find a method to remove the path of a file. Has anyone tried to do this and if so, how?

EDIT I am displaying the contents of a zipfile in a TAbListView where the path for each file is stored in the archive. The items were added to the zip file with the StoreOptions set at [soStripDrive], so the path is stored in the TAbListView.Items.Item[I].Subitem[9] for each file in the zip file. I am looking to strip the paths and then save the archive so that none of the files have paths.

Paths before removal

TAbListView.Items.Item[0].Subitem[9] := \DelphiXE4\Projects\Abbrevia\Unit1.pas

TAbListView.Items.Item[1].Subitem[9] := \DelphiXE4\Projects\Abbrevia\Unit1.dfm

Paths after removal

TAbListView.Items.Item[0].Subitem[9] := '';

TAbListView.Items.Item[1].Subitem[9] := '';

So the zipped items do not have any paths.

1

There are 1 best solutions below

0
On

AFAICT, you can't change the name in the archive (zip) without actually extracting the file and then putting it back in without storing the path in the first place.

The obvious place to try and change it would be with TAbZipItem.StoredPath, but that's read only; using TAbZipItem.FileName works fine when compiling and running, but has no effect. Nothing you do in the TAbsListView will change anything, as it's just displaying content and has nothing to do with the underlying zip archive.