diff options
Diffstat (limited to 'src/corelib/gdi/gfx_utils.pas')
-rw-r--r-- | src/corelib/gdi/gfx_utils.pas | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/corelib/gdi/gfx_utils.pas b/src/corelib/gdi/gfx_utils.pas new file mode 100644 index 00000000..70078859 --- /dev/null +++ b/src/corelib/gdi/gfx_utils.pas @@ -0,0 +1,43 @@ +unit gfx_utils; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + + +{$I gfx_utils_intf.inc} + + +implementation + + +// File utils +function ExtractTargetSymLinkPath(ALink: string): string; +begin +{ + var + info : _stat; + ..... + fullname := FDirectoryName + e.Name; + if lstat(PChar(fullname),info) = 0 then + begin + e.IsLink := ((sr.Mode and $F000) = $A000); + if e.IsLink then + begin + SetLength(e.LinkTarget, MAX_PATH); // length was 256 + r := libc.readlink(PChar(fullname),@(e.LinkTarget[1]), sizeof(e.LinkTarget)); + if r > 0 then + SetLength(e.LinkTarget, r) + else + e.LinkTarget := ''; + libc.stat(PChar(fullname), info); + end; +} +end; + + +end. + |