diff --git a/components/lazmapviewer/examples/fulldemo/main.pas b/components/lazmapviewer/examples/fulldemo/main.pas index 3278744d4..39607626f 100644 --- a/components/lazmapviewer/examples/fulldemo/main.pas +++ b/components/lazmapviewer/examples/fulldemo/main.pas @@ -134,11 +134,12 @@ type const MAX_LOCATIONS_HISTORY = 50; MAP_PROVIDER_FILENAME = 'map-providers.xml'; + HOMEDIR = '../../../../'; USE_DMS = true; var PointFormatSettings: TFormatsettings; - CacheDir: String = '../../../../'; // share the cache in both example projects + CacheDir: String = HOMEDIR + 'cache/'; // share the cache in both example projects function CalcIniName: String; @@ -340,7 +341,7 @@ begin fn := Application.Location + 'mapmarker.png'; if not FileExists(fn) then - MessageDlg('Copy the file "mapmarker.png" from the source to the app binary directory.', + MessageDlg('Copy the file "mapmarker.png" from the source folder to the folder with the executable.', mtError, [mbOK], 0) else begin @@ -350,8 +351,13 @@ begin POIImage.LoadFromFile(fn); end; - ForceDirectories(HOMEDIR + 'cache/'); - MapView.CachePath := HOMEDIR + 'cache/'; + CacheDir := HOMEDIR + 'cache/'; + if not ForceDirectories(CacheDir) then + begin + CacheDir := GetAppConfigDir(false) + 'cache/'; + ForceDirectories(CacheDir); + end; + MapView.CachePath := CacheDir; MapView.GetMapProviders(CbProviders.Items); CbProviders.ItemIndex := CbProviders.Items.Indexof(MapView.MapProvider); MapView.DoubleBuffered := true;