Added: App.UserPath property
Fixed: bug in resetting hash cursor
This commit is contained in:
parent
e2f278892e
commit
909f804569
39
X2UtApp.pas
39
X2UtApp.pas
@ -132,6 +132,7 @@ type
|
|||||||
FVersion: TX2AppVersion;
|
FVersion: TX2AppVersion;
|
||||||
FPath: String;
|
FPath: String;
|
||||||
FMainPath: String;
|
FMainPath: String;
|
||||||
|
FUserPath: String;
|
||||||
protected
|
protected
|
||||||
function GetModule(const AModule: THandle): String; virtual;
|
function GetModule(const AModule: THandle): String; virtual;
|
||||||
procedure GetPath(); virtual;
|
procedure GetPath(); virtual;
|
||||||
@ -160,6 +161,9 @@ type
|
|||||||
//:! slash is included in the path.
|
//:! slash is included in the path.
|
||||||
property MainPath: String read FMainPath;
|
property MainPath: String read FMainPath;
|
||||||
|
|
||||||
|
//:$ Contains the path to the user's Application Data
|
||||||
|
property UserPath: String read FUserPath;
|
||||||
|
|
||||||
//:$ Contains the application's version information
|
//:$ Contains the application's version information
|
||||||
property Version: TX2AppVersion read FVersion;
|
property Version: TX2AppVersion read FVersion;
|
||||||
end;
|
end;
|
||||||
@ -169,6 +173,8 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
|
ActiveX,
|
||||||
|
ShlObj,
|
||||||
SysUtils,
|
SysUtils,
|
||||||
TypInfo,
|
TypInfo,
|
||||||
Windows;
|
Windows;
|
||||||
@ -286,14 +292,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TX2App.GetPath;
|
procedure TX2App.GetPath();
|
||||||
|
function FixPath(const APath: String): String;
|
||||||
|
begin
|
||||||
|
Result := {$IFDEF D6}IncludeTrailingPathDelimiter
|
||||||
|
{$ELSE}IncludeTrailingBackslash{$ENDIF}
|
||||||
|
(APath);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
ifMalloc: IMalloc;
|
||||||
|
pIDL: PItemIDList;
|
||||||
|
cPath: array[0..MAX_PATH] of Char;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FPath := {$IFDEF D6}IncludeTrailingPathDelimiter
|
FPath := FixPath(ExtractFilePath(GetModule(SysInit.HInstance)));
|
||||||
{$ELSE}IncludeTrailingBackslash{$ENDIF}
|
FMainPath := FixPath(ExtractFilePath(GetModule(0)));
|
||||||
(ExtractFilePath(GetModule(SysInit.HInstance)));
|
|
||||||
FMainPath := {$IFDEF D6}IncludeTrailingPathDelimiter
|
SHGetMalloc(ifMalloc);
|
||||||
{$ELSE}IncludeTrailingBackslash{$ENDIF}
|
try
|
||||||
(ExtractFilePath(GetModule(0)));
|
FillChar(cPath, SizeOf(cPath), #0);
|
||||||
|
SHGetSpecialFolderLocation(0, CSIDL_APPDATA, pIDL);
|
||||||
|
SHGetPathFromIDList(pIDL, @cPath);
|
||||||
|
|
||||||
|
FUserPath := FixPath(cPath);
|
||||||
|
finally
|
||||||
|
ifMalloc := nil;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -610,12 +610,10 @@ end;
|
|||||||
procedure TX2HashCursor.First();
|
procedure TX2HashCursor.First();
|
||||||
begin
|
begin
|
||||||
if Length(FBucketPath) > 1 then
|
if Length(FBucketPath) > 1 then
|
||||||
begin
|
|
||||||
SetLength(FBucketPath, 1);
|
SetLength(FBucketPath, 1);
|
||||||
FBucketPath[0].Index := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
FCurrent := nil;
|
FBucketPath[0].Index := 0;
|
||||||
|
FCurrent := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TX2HashCursor.Next(): Boolean;
|
function TX2HashCursor.Next(): Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user