[Lazarus] Command line interpretation on Linux console program...
Marco van de Voort
fpc at pascalprogramming.org
Fri Apr 12 09:34:00 CEST 2019
Op 2019-04-11 om 22:03 schreef Bo Berglund via lazarus:
>
> 1) When I enter a file name as ~/Videos/input.mp4 then FileExists()
> reports that the file does not exist even though I can clearly see it.
> If I instead use /home/user/Videos/input.mp4 then it will see it
> properly. Same if I use the syntax ./filename.mp4 when the file is in
> the current dir.
> Why does FileExists() not recognize ~ as shorthand for the home dir?
> It is rather inconvenient to be forced to use the longer paths...
Because expanding ~ happens on the shell level, and programs usually
don't see it (they get their parameters already substituted). If they
use ~ and other shell modifiers themselves, e.g. in configuration, it is
the programmer's responsibility to do substitutions he likes to support.
> 2) Another issue concerns the parsing of command line parameters.
> Originally I had set it up to use ; as separator for the two time
> values of a clip, starttime and duration (in seconds) as follows:
> t1234;500 for a duration 500 s clip starting at 1234 s into the source
> video.
> But for some reason the ParamCount variable contains 3 when the
> command line looks like this:
Here also, the shell does parameter separation on *nix, and the program
receives an array.
More information about the lazarus
mailing list