Initial
Исходный код версии 2.0
This commit is contained in:
45
sources/shared_units/__history/cde_dir.pas;14
Normal file
45
sources/shared_units/__history/cde_dir.pas;14
Normal file
@@ -0,0 +1,45 @@
|
||||
unit cde_dir;
|
||||
{$mode delphi}
|
||||
{$codepage UTF8}
|
||||
interface
|
||||
uses LazFileUtils, sysutils, windows, shlobj, ANBFormatString, LazUTF8, cde_types;
|
||||
{stdcalls}
|
||||
function GetCDEPath: String; STDCALL;
|
||||
function GetSpecialPath(const CSIDL: Word): 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(GetSpecialPath(CSIDL_WINDOWS)),
|
||||
PChar(GetSpecialPath(CSIDL_WINDOWS))[0] + ':\',
|
||||
IncludeTrailingBackslash(GetSpecialPath(CSIDL_DESKTOP)),
|
||||
IncludeTrailingBackslash(GetSpecialPath(CSIDL_PERSONAL)),
|
||||
IncludeTrailingBackslash(GetSpecialPath(CSIDL_FONTS)),
|
||||
IncludeTrailingBackslash(GetSpecialPath(CSIDL_APPDATA))
|
||||
]));
|
||||
end;
|
||||
end.
|
Reference in New Issue
Block a user