On Fri, 31 Oct 2008, Marc Santhoff wrote:
> Hi, > > is there any function or set of functions for handling symbolic links > inside the file system at an os independant level in fpcs libraries? > > Unix-like systems have soft symlinks (Linux, FreeBSD), Windows has .lnk > files upt to XP and AFAIR Windows Vista has some other stuff I don't > know about yet. > > What I'd need would be sth. like: > > function IsLink(<filehandle or name>): boolean; > function GetLinkTarget(<filehandle or name>): <filehandle or name>; > > Any help on this topic is welcome ... ;) Fpc 2.3.1 supports faSymLink in the FindFirst/FindNext series of calls. If it is included in the attributes, then symbolic links are included as symbolic links and not as the file/dir they refer to. This works cross-platform. So you could do something like function IsLink(AFileName : string): boolean; Var Info : TSearchRec; begin Result:=FindFirst(AFileName,faSymLink,info)=0; If Result then begin Result:=(info.attr and faSymLink)=faSymLink; FindClose(info); end; end; Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal