Mega Code Archive

 
Categories / Delphi / Functions
 

How to use the linux expand function

Title: How to use the linux expand function 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;