unit cde_dir; {$mode delphi} {$codepage UTF8} interface uses LazFileUtils, sysutils, windows, shlobj, ANBFormatString, LazUTF8, cde_types; {stdcalls} function GetCDEPath: String; STDCALL; function ExpandPath(const Path: String): String; STDCALL; implementation function GetCDEPath: String; begin SetCurrentDirUTF8(ExtractFilePath(ParamStr(0))); SetCurrentDirUTF8('..\'); Result:= IncludeTrailingBackslash(GetCurrentDirUTF8); end; function SpecialPath(const CSIDL: Word): PChar; var s: String; begin SetLength(s, MAX_PATH); if not SHGetSpecialFolderPath(0, PChar(s), CSIDL, True) then s:= ''; Result:= PChar(s); end; function ExpandPath(const Path: String): String; begin Result:= SysToUTF8(FormatStr(Path, [ pth_windir, pth_windisc, pth_desktop, pth_personal, pth_fonts, pth_wappdata ], [ IncludeTrailingBackslash(SpecialPath(CSIDL_WINDOWS)), PChar(SpecialPath(CSIDL_WINDOWS))[0] + ':\', IncludeTrailingBackslash(SpecialPath(CSIDL_DESKTOP)), IncludeTrailingBackslash(SpecialPath(CSIDL_PERSONAL)), IncludeTrailingBackslash(SpecialPath(CSIDL_FONTS)), IncludeTrailingBackslash(SpecialPath(CSIDL_APPDATA)) ])); end; end.