[fpc-pascal] Archive libraries

Michael Van Canneyt michael at freepascal.org
Sat Aug 22 09:31:29 CEST 2020



On Sat, 22 Aug 2020, Darius Blaszyk via fpc-pascal wrote:

> On Thu, Aug 20, 2020 at 11:43 PM Darius Blaszyk <dhkblaszyk at gmail.com>
> wrote:
>
>>
>> I have done so for the xz format already. The code checks first if the
>> utility is available and then invokes it. Potentially any other utility
>> might be included that way. However, I was hoping to include mainly native
>> libraries where possible to reduce dependencies.
>>
>
> By calling the archive utility from the command line I am able to add more
> formats easily. One thing though is that to be more robust I would like to
> check the availability of the utility from the command line. One way of
> doing this is using "whereis", but I was wondering if something like this
> exists already in FPC?

Yes:

https://www.freepascal.org/docs-html/current/rtl/sysutils/exesearch.html

Combine with GetEnvironmentVariable():

Exists:=ExeSearch('myexe',GetEnvironmentVariable('PATH'));

Michael.


More information about the fpc-pascal mailing list