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

View File

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

View File

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

View File

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

View File

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

View File

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