...use the linux expand function?
Author: Gerard Knight
// example of using the linux wordexp function
// see: http://www.opengroup.org/onlinepubs/007908799/xsh/wordexp.html
// I use it to expand file paths that use the ~/ character instead of /home/<current user>/
function SystemExpandFilePath(aFilePath: string): string;
{$IFDEF LINUX}
var
awordexp_t: wordexp_t;
{$ENDIF}
begin
Result := aFilePath;
{$IFDEF LINUX}
{
Expand the path, i.e. in linux ~ = user home
}
if LibC.wordexp(PChar(aFilePath), awordexp_t, 0) = 0 then
Result := PChar(awordexp_t.we_wordv^);
{$ENDIF}
end;
printed from
www.swissdelphicenter.ch
developers knowledge base