<div dir="ltr">Thank you Michael!<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 22, 2020 at 9:31 AM Michael Van Canneyt <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On Sat, 22 Aug 2020, Darius Blaszyk via fpc-pascal wrote:<br>
<br>
> On Thu, Aug 20, 2020 at 11:43 PM Darius Blaszyk <<a href="mailto:dhkblaszyk@gmail.com" target="_blank">dhkblaszyk@gmail.com</a>><br>
> wrote:<br>
><br>
>><br>
>> I have done so for the xz format already. The code checks first if the<br>
>> utility is available and then invokes it. Potentially any other utility<br>
>> might be included that way. However, I was hoping to include mainly native<br>
>> libraries where possible to reduce dependencies.<br>
>><br>
><br>
> By calling the archive utility from the command line I am able to add more<br>
> formats easily. One thing though is that to be more robust I would like to<br>
> check the availability of the utility from the command line. One way of<br>
> doing this is using "whereis", but I was wondering if something like this<br>
> exists already in FPC?<br>
<br>
Yes:<br>
<br>
<a href="https://www.freepascal.org/docs-html/current/rtl/sysutils/exesearch.html" rel="noreferrer" target="_blank">https://www.freepascal.org/docs-html/current/rtl/sysutils/exesearch.html</a><br>
<br>
Combine with GetEnvironmentVariable():<br>
<br>
Exists:=ExeSearch('myexe',GetEnvironmentVariable('PATH'));<br>
<br>
Michael.<br>
</blockquote></div>