[fpc-pascal] Target path of a SymLink file

Vincent Snijders vsnijders at quicknet.nl
Wed Aug 15 12:37:22 CEST 2007


Graeme Geldenhuys schreef:
> Hi,
> 
> Is there a function in SysUtils or some other place in RTL that I can
> use to extract the target path of a symlink file?  I'm using
> FindFirst/FindNext.  The sr.Attrib and faSymLink is True, but I can't
> (in a easy way) see how I can actually find out where it points to.
> I'm thinking x-platform here.
> 
> Something like ExtractSymLinkPath(). :)  Thinking of other available
> functions like ExpandUNCFileName() or ExtractFilePath() or
> ExtractRelativePath() etc..
> 
> I have the following code that works, but then I need to wrap it in
> IFDEF's so it doesn't execute under Windows.  I don't want IFDEF's in
> my code!  I'm hoping RTL has something already and just returns a
> blank string for Windows, just like the faSymLink which means nothing
> under Windows, yet is available.

If you cannot find it in the RTL, consider submitting ReadAllLinks from the LCL's 
fileutil unit to the FPC team. At least it doesn't depend on libc (directly).

Vincent



More information about the fpc-pascal mailing list