Extract archive with XAD plugin
Extract archive with XAD plugin
Hello,
i would like extract an archive LHA to a destination but i don't understand inputs indicated in xad.guide...
i understand id and idx (dst$ is ok). I try many things but nothing work...
Plugin is activate with:
@REQUIRE "xad", {InstallAdapter = True}
Another thing xad.ExtractFile() command don't change of color in IDE (on PC and on FlowStudio on MorphOS)
Andreas, if you see my post, an simple example for each command will be very appreciated
i would like extract an archive LHA to a destination but i don't understand inputs indicated in xad.guide...
i understand id and idx (dst$ is ok). I try many things but nothing work...
Plugin is activate with:
@REQUIRE "xad", {InstallAdapter = True}
Another thing xad.ExtractFile() command don't change of color in IDE (on PC and on FlowStudio on MorphOS)
Andreas, if you see my post, an simple example for each command will be very appreciated
Re: Extract archive with XAD plugin
The command copyfiles() work for extraction but in the documention it says it's lower speed than xad.ExtractFile().
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Extract archive with XAD plugin
Yes, CopyFile() is slower. If you want to use xad.ExtractFile() instead, you need to do something like this:
Not very difficult.
Code: Select all
xad.OpenArchive(1, "test.lha")
XAD_ARCHIVE = xad.GetObjectType()
numentries = GetAttribute(XAD_ARCHIVE, 1, #XADATTRNUMENTRIES)
For Local k = 0 To numentries - 1 Do xad.ExtractFile(1, k, <dstfile>)
xad.CloseArchive(1)
Don't know if FlowStudio supports highlighting plugin APIs but on Windows this definitely works if you have xad.hwp installed. Just tried it here.papiosaur wrote: ↑Wed May 10, 2023 5:03 pm Another thing xad.ExtractFile() command don't change of color in IDE (on PC and on FlowStudio on MorphOS)
Re: Extract archive with XAD plugin
Thank a lot Andreas for your answer !
Yes, i didn't have installed hurl plugin...
Yes, i didn't have installed hurl plugin...
Re: Extract archive with XAD plugin
@Andreas,
Bizarrely, it doesn't work.
i have the same code, a message error apppear "A Xad error has occured"...
Bizarrely, it doesn't work.
i have the same code, a message error apppear "A Xad error has occured"...
Re: Extract archive with XAD plugin
I tried Andreas code, too. And got the same error-message, you got.
But only if I used a Pathname for "<destfile>". Using a filename here (as <destFILE> implies), lets the code work.
Best regards!
George
But only if I used a Pathname for "<destfile>". Using a filename here (as <destFILE> implies), lets the code work.
Best regards!
George
Re: Extract archive with XAD plugin
Thanks evil for your return.
A filename as destination ? Sorry i don't understand, i would extract files from an archive to a destination path not to a file...
A filename as destination ? Sorry i don't understand, i would extract files from an archive to a destination path not to a file...
Re: Extract archive with XAD plugin
if i write "ram:toto" as dstfile, i obtain an ELF file (MorphOS Executable) when i "extract" the archive.
It's a file from the archive...
It's a file from the archive...
Re: Extract archive with XAD plugin
xad.ExtractFile() extracts only one file from the archive (from position idx). If you want to extract the complete archive, you have to make a loop, create the directories and extract the files there. Example:
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
DebugPrint(xad.GetFileAtIndex(1, k))
If Not Exists(PathPart(xad.GetFileAtIndex(1, k))) And Not EmptyStr(PathPart(xad.GetFileAtIndex(1, k)))
MakeDirectory(PathPart(xad.GetFileAtIndex(1, k)))
EndIf
xad.ExtractFile(1, k, xad.GetFileAtIndex(1, k))
Next
xad.CloseArchive(1)
Re: Extract archive with XAD plugin
Thanks a lot Flink ! it work fine !
Do you have a solution to extract directly to a destination path please ? ram: for example
Do you have a solution to extract directly to a destination path please ? ram: for example