56 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| unit cde_dir;
 | |
| {$mode delphi}
 | |
| {$codepage UTF8}
 | |
| interface
 | |
| uses LazFileUtils, sysutils, windows, shlobj, ANBFormatString;
 | |
| {stdcalls}
 | |
| function GetCDEPath: String; STDCALL;
 | |
| implementation
 | |
| function GetCDEPath: String;
 | |
| begin
 | |
| SetCurrentDirUTF8(ExtractFilePath(ParamStr(0)));
 | |
| SetCurrentDirUTF8('..\');
 | |
| Result:= IncludeTrailingBackslash(GetCurrentDirUTF8);
 | |
| end;
 | |
| function GetSpecialPath(const CSIDL: Word): String;
 | |
| var s: String;
 | |
| begin
 | |
| SetLength(s, MAX_PATH);
 | |
| if not SHGetSpecialFolderPath(0, PChar(s), CSIDL, True) then
 | |
|  s:= '';
 | |
| Result:= s;
 | |
| end;
 | |
| function ExpandPath(const Path: String): String; STDCALL;
 | |
| begin
 | |
| Result:= SysToUTF8(FormatStr(Path,
 | |
|                                   [pth_midir,
 | |
|                                    pth_midata,
 | |
|                                    pth_rnr,
 | |
|                                    pth_rnrskins,
 | |
|                                    pth_rnrudir,
 | |
|                                    pth_windir,
 | |
|                                    pth_windisc,
 | |
|                                    pth_desktop,
 | |
|                                    pth_personal,
 | |
|                                    pth_fonts,
 | |
|                                    pth_wappdata,
 | |
|                                    pth_wtmp
 | |
|                                   ],
 | |
|                                   [
 | |
|                                    GetInstallerDir,
 | |
|                                    GetInstallerDataDir,
 | |
|                                    GetRNRPath,
 | |
|                                    GetSkinsPath,
 | |
|                                    GetRNRUserDir,
 | |
|                                    IncludeTrailingBackslash(GetSpecialPath(CSIDL_WINDOWS)),
 | |
|                                    PChar(GetSpecialPath(CSIDL_WINDOWS))[0] + ':\',
 | |
|                                    IncludeTrailingBackslash(GetSpecialPath(CSIDL_DESKTOP)),
 | |
|                                    IncludeTrailingBackslash(GetSpecialPath(CSIDL_PERSONAL)),
 | |
|                                    IncludeTrailingBackslash(GetSpecialPath(CSIDL_FONTS)),
 | |
|                                    IncludeTrailingBackslash(GetSpecialPath(CSIDL_APPDATA)),
 | |
|                                    GetWinTempDir
 | |
|                                   ]));
 | |
| end;
 | |
| 
 | |
| end.
 |