Extract archive with XAD plugin

Find quick help here to get you started with Hollywood
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

ok find i have added "Changedirectory" before open archive and it work ;-)
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

I had tried to add the Volume to the PathPart. Something like "RAM:"..PathPart(...
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Bizarre, i get error during extraction and all files are not extracted...

Seems XAD not extract empty drawers... and i have the same problem with CopyFiles().

Andreas : could you add this features for next version please for XAD and CopyFiles() ?
Last edited by papiosaur on Wed May 17, 2023 3:41 pm, edited 1 time in total.
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

That is a problem with my script. It needs to check the type with xad.GetFileAttributes() before extracting or creating a directory.
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

Please try this:

Code: Select all

filename$="test.lha"
If Not Exists(filename$) Then DebugPrint(filename$,"not found")
xad.OpenArchive(1, filename$)
XAD_ARCHIVE = xad.GetObjectType()
numentries = GetAttribute(XAD_ARCHIVE, 1, #XADATTRNUMENTRIES)
For Local k = 0 To numentries - 1
	Local file$=xad.GetFileAtIndex(1, k)
	Local path$=PathPart(file$)
	DebugPrint(file$)
	If Not Exists(path$) And Not EmptyStr(path$)
		MakeDirectory(path$)
	EndIf
	If xad.GetFileAttributes(1, k).Type = #DOSTYPE_DIRECTORY
		MakeDirectory(file$)
	Else
		xad.ExtractFile(1, k, file$)
	EndIf
Next
xad.CloseArchive(1)
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Thanks for this new example, i've tried and i have this error message:

Error creating directory OpenBor/paks
in function MakeDirectory(file$)

Note: this drawer is an empty directory (to save pak file)
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

i try activate my progress bar but don't work.

It work with DownloadFile() but don't with Extractfile()...

i try to use progress option but don't work.

If you have an idea, i take ;-)
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Extract archive with XAD plugin

Post by Flinx »

Can you make a little archive so that I can reproduce the error?
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Yes, of course, this is the link of the archive:

https://www.morphos-storage.net/dl.php?id=1532994
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Extract archive with XAD plugin

Post by papiosaur »

Maybe CopyFile() command is better because i just want to extract all files of an archive to a destination...

xad.extractfile seems very complicated i found no ?

If you have an example of progressbar with CopyFile() command with an archive, i'm interested.

Thanks !
Post Reply