[Lazarus] How to determine the file extension to use
waldo kitty
wkitty42 at windstream.net
Fri Oct 23 21:23:49 CEST 2009
Vincent Snijders wrote:
> waldo kitty schreef:
>>
>> doesn't the above do the "IFDEF" thing that you said you didn't want
>> to do? ;) :lol:
>
> That is correct, let the library do the IFDEF, so you don't have to do it.
:) but i thought the idea was for IFDEF to not be used at all... maybe i misread
or simply misunderstood...
>> one must also remember that .exe is not the only executable extension
>> on windows, OS/2 and DOS platforms... there is also .com... i must
>> also ask, are not shell scripts "executable" or are we looking solely
>> at binary executables?
>
> That depends on the purpose. FPC cannot create .com files, so for
> example the file name of a fpc executable is
> ExtractFileNameWithoutExt('projectfilename.lpi')+GetExeExt;
sure, fpc cannot create .com files but i still can and do for small quick items
;) the point being that .exe is not the only executables on these platforms...
>> seems to me that a more generic GetFileExt type function would be
>> better... one that might also check the linux file permissions to
>> determine if the file is executable or not... i have numerous *nix
>> executable files with and without extensions on them... checking the
>> perms is the only way to know if they can will start straight up or if
>> they must be given a kickstart (ie: sh foo.sh or php foo.php or even
>> perl foo.pl) ;)
>
> And that is why there is
> http://lazarus-ccr.sourceforge.net/docs/lcl/fileutil/fileisexecutable.html
hummm... and that works on all platforms? not just *nix? i wonder if it, too,
looks at the file's extension on non-*nix platforms? ;)
More information about the Lazarus
mailing list