[fpc-pascal] Search path order for fpc.cfg
Michael Van Canneyt
michael at freepascal.org
Sat Apr 11 16:48:15 CEST 2020
On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:
>> It will create one in your home directory if it detects you do not have
> root access.
> Could you explain that?
> Of course if you can show me a trick for configuring a script that will
> install fpc in the home directory (.fpc.cfg), with for example the
> hard-coded directory /home/user/instantfpc, I will use it.
> But the condition will be that the user has nothing write, only run a
The default install.sh used by FPC calls samplecfg to create the config file
for the compiler.
samplecfg is located in compiler/utils.
Line 40 and following contain:
# Detect if we have write permission in sysdir.
if [ -w "$sysdir" ] ; then
echo Write permission in $sysdir.
echo No write premission in $sysdir.
So as you can see, when the user does not have write permissions in /etc or
/local/etc, it will write a config file in the user home directory, exactly
where the compiler will pick it up.
So you see, we've covered the situation you are trying to solve.
It has been so for ages, all you need to do is use what is there correctly.
There is no need to change anything.
More information about the fpc-pascal