- Changed profile, preset, locations and radar cache path to the user directory (fixes #50)

This commit is contained in:
Andreas Schneider 2009-12-09 00:19:45 +01:00
parent 1759e0763c
commit 3df7b446f5
6 changed files with 320 additions and 306 deletions

View File

@ -31,6 +31,7 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads} {$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
SysUtils,
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, LResources, lnetvisual, LazOpenGLContext, UdmNetwork, UfrmMain, Forms, LResources, lnetvisual, LazOpenGLContext, UdmNetwork, UfrmMain,
UfrmLogin, UfrmInitialize, UfrmAccountControl, virtualtreeview_package, UfrmLogin, UfrmInitialize, UfrmAccountControl, virtualtreeview_package,
@ -45,8 +46,14 @@ uses
{$IFDEF WINDOWS}{$R CentrED.rc}{$ENDIF} {$IFDEF WINDOWS}{$R CentrED.rc}{$ENDIF}
function GetApplicationName: String;
begin
Result := 'CentrED';
end;
begin begin
{$I CentrED.lrs} {$I CentrED.lrs}
OnGetApplicationName := @GetApplicationName;
Application.Initialize; Application.Initialize;
Application.CreateForm(TdmNetwork, dmNetwork); Application.CreateForm(TdmNetwork, dmNetwork);
Application.Run; Application.Run;

View File

@ -22,8 +22,8 @@ object frmLogin: TfrmLogin
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 16
Top = 231 Top = 230
Width = 481 Width = 481
Alignment = taCenter Alignment = taCenter
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]

View File

@ -172,8 +172,7 @@ begin
lblCopyright.Caption := Format('UO CentrED Client Version %s (c) %s', lblCopyright.Caption := Format('UO CentrED Client Version %s (c) %s',
[ProductVersion, Copyright]); [ProductVersion, Copyright]);
FProfilePath := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)) FProfilePath := GetAppConfigDir(False) + 'Profiles' + PathDelim;
+ 'Profiles' + PathDelim;
ForceDirectories(FProfilePath); ForceDirectories(FProfilePath);
if FindFirst(FProfilePath + '*.ini', faAnyFile, searchRec) = 0 then if FindFirst(FProfilePath + '*.ini', faAnyFile, searchRec) = 0 then
begin begin

View File

@ -275,6 +275,7 @@ type
protected protected
{ Members } { Members }
FAppDir: String; FAppDir: String;
FConfigDir: String;
FX: Integer; FX: Integer;
FY: Integer; FY: Integer;
FDrawDistance: Integer; FDrawDistance: Integer;
@ -821,6 +822,8 @@ var
searchRec: TSearchRec; searchRec: TSearchRec;
begin begin
FAppDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName)); FAppDir := IncludeTrailingPathDelimiter(ExtractFilePath(Application.ExeName));
FConfigDir := GetAppConfigDir(False);
ForceDirectories(FConfigDir);
FLandscape := ResMan.Landscape; FLandscape := ResMan.Landscape;
FLandscape.OnChange := @OnLandscapeChanged; FLandscape.OnChange := @OnLandscapeChanged;
@ -850,7 +853,7 @@ begin
vstChat.NodeDataSize := SizeOf(TChatInfo); vstChat.NodeDataSize := SizeOf(TChatInfo);
pnlChatHeader.AnchorSide[akBottom].Control := pnlBottom; pnlChatHeader.AnchorSide[akBottom].Control := pnlBottom;
FLocationsFile := FAppDir + 'Locations.dat'; FLocationsFile := FConfigDir + 'Locations.dat';
vstLocations.NodeDataSize := SizeOf(TLocationInfo); vstLocations.NodeDataSize := SizeOf(TLocationInfo);
try try
if FileExists(FLocationsFile) then if FileExists(FLocationsFile) then
@ -879,7 +882,7 @@ begin
FVirtualTiles := TWorldItemList.Create(True); FVirtualTiles := TWorldItemList.Create(True);
FUndoList := TPacketList.Create(True); FUndoList := TPacketList.Create(True);
FRandomPresetLocation := FAppDir + 'RandomPresets' + PathDelim; FRandomPresetLocation := FConfigDir + 'RandomPresets' + PathDelim;
if not DirectoryExists(FRandomPresetLocation) then if not DirectoryExists(FRandomPresetLocation) then
CreateDir(FRandomPresetLocation); CreateDir(FRandomPresetLocation);

View File

@ -5,6 +5,7 @@ object frmRadarMap: TfrmRadarMap
Width = 479 Width = 479
HorzScrollBar.Page = 478 HorzScrollBar.Page = 478
VertScrollBar.Page = 359 VertScrollBar.Page = 359
ActiveControl = sbMain
Caption = 'Radar Map (1:8)' Caption = 'Radar Map (1:8)'
ClientHeight = 360 ClientHeight = 360
ClientWidth = 479 ClientWidth = 479
@ -14,7 +15,9 @@ object frmRadarMap: TfrmRadarMap
OnResize = FormResize OnResize = FormResize
Position = poOwnerFormCenter Position = poOwnerFormCenter
ShowInTaskBar = stAlways ShowInTaskBar = stAlways
LCLVersion = '0.9.29'
object pnlBottom: TPanel object pnlBottom: TPanel
Left = 0
Height = 21 Height = 21
Top = 339 Top = 339
Width = 479 Width = 479
@ -26,7 +29,8 @@ object frmRadarMap: TfrmRadarMap
object lblPosition: TLabel object lblPosition: TLabel
Left = 8 Left = 8
Height = 21 Height = 21
Width = 38 Top = 0
Width = 39
Align = alLeft Align = alLeft
BorderSpacing.Left = 8 BorderSpacing.Left = 8
Layout = tlCenter Layout = tlCenter
@ -34,16 +38,18 @@ object frmRadarMap: TfrmRadarMap
end end
end end
object sbMain: TScrollBox object sbMain: TScrollBox
Left = 0
Height = 339 Height = 339
Top = 0
Width = 479 Width = 479
HorzScrollBar.Page = 474
HorzScrollBar.Range = 292
VertScrollBar.Page = 334
VertScrollBar.Range = 202
Align = alClient Align = alClient
ClientHeight = 335
ClientWidth = 475
TabOrder = 1 TabOrder = 1
object pbRadar: TPaintBox object pbRadar: TPaintBox
Left = 0
Height = 202 Height = 202
Top = 0
Width = 292 Width = 292
OnMouseDown = pbRadarMouseDown OnMouseDown = pbRadarMouseDown
OnMouseMove = pbRadarMouseMove OnMouseMove = pbRadarMouseMove

View File

@ -21,7 +21,7 @@
* CDDL HEADER END * CDDL HEADER END
* *
* *
* Portions Copyright 2007 Andreas Schneider * Portions Copyright 2009 Andreas Schneider
*) *)
unit UfrmRadar; unit UfrmRadar;
@ -179,8 +179,7 @@ begin
begin begin
checksum := ABuffer.ReadCardinal; checksum := ABuffer.ReadCardinal;
realChecksum := crc32(0, nil, 0); realChecksum := crc32(0, nil, 0);
radarMapFileName := IncludeTrailingPathDelimiter(ExtractFilePath( radarMapFileName := GetAppConfigDir(False) + 'RadarMap.cache';
Application.ExeName)) + 'RadarMap.cache';
if FileExists(radarMapFileName) then if FileExists(radarMapFileName) then
begin begin
radarMapFile := TFileStream.Create(radarMapFileName, fmOpenRead); radarMapFile := TFileStream.Create(radarMapFileName, fmOpenRead);