LazMapViewer: Disable creating the cache directory at designtime. Partial sync with main full_demo project.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8840 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-06-20 10:45:59 +00:00
parent 839adfaf80
commit 71a45035c5
4 changed files with 30 additions and 14 deletions

View File

@ -145,12 +145,10 @@ type
const
MAX_LOCATIONS_HISTORY = 50;
MAP_PROVIDER_FILENAME = 'map-providers.xml';
HOMEDIR = '../../../../';
USE_DMS = true;
var
PointFormatSettings: TFormatsettings;
CacheDir: String = HOMEDIR + 'cache/'; // share the cache in both example projects
function CalcIniName: String;
begin
@ -438,6 +436,8 @@ end;
procedure TMainForm.FormCreate(Sender: TObject);
var
homeDir: String;
cacheDir: String;
fn: String;
begin
cInputQueryEditSizePercents := 0;
@ -454,15 +454,16 @@ begin
POIImage.LoadFromFile(fn);
end;
CacheDir := HOMEDIR + 'cache/';
if not ForceDirectories(CacheDir) then
homeDir := Application.Location + '../../../'; // this should be the "examples" folder
cacheDir := homeDir + 'cache/';
if not ForceDirectories(cacheDir) then
begin
CacheDir := GetAppConfigDir(false) + 'cache/';
ForceDirectories(CacheDir);
cacheDir := GetAppConfigDir(false) + 'cache/';
ForceDirectories(cacheDir);
end;
MapView.CachePath := CacheDir;
MapView.CachePath := cacheDir;
MapView.GetMapProviders(CbProviders.Items);
CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider);
CbProviders.ItemIndex := CbProviders.Items.IndexOf(MapView.MapProvider);
MapView.DoubleBuffered := true;
MapView.Zoom := 1;
CbZoomToCursor.Checked := MapView.ZoomToCursor;