Re: [fpc-pascal] Handling recursive symlinks in Linux

2011-02-19 Thread Michael Van Canneyt



On Sat, 19 Feb 2011, brian wrote:

I'm trying to convert a Delphi console-mode program which needs to walk 
directory trees to FP **and Linux** - is there a standard way to detect and 
handle recursive symlinks, if the user has been daft enough to create them?


You can use faSymLink in FindFirst/FindNext to detect symbolic links (this works on 
windows as well) and then use fpReadLink (unit baseunix) to see where the 
link leads too.


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Handling recursive symlinks in Linux

2011-02-19 Thread Jonas Maebe

On 19 Feb 2011, at 07:57, brian wrote:

 I'm trying to convert a Delphi console-mode program which needs to walk 
 directory trees to FP **and Linux** - is there a standard way to detect and 
 handle recursive symlinks, if the user has been daft enough to create them?

Many programs handle this by following symlinks only to a certain maximum 
depth. E.g., they print an error if they have followed 16 or more symlinks 
already. An alternative is to keep track of every directory you have traversed 
(or are traversing) already, and to skipping symlinks pointing to such 
directories.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Handling recursive symlinks in Linux

2011-02-18 Thread brian
I'm trying to convert a Delphi console-mode program which needs to 
walk directory trees to FP **and Linux** - is there a standard way to 
detect and handle recursive symlinks, if the user has been daft enough 
to create them?


Thanks,

Brian.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal