LazMapViewer: Fix write-permission and file-not-found issues in fulldemo on Mac.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8267 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-04-27 16:28:40 +00:00
parent 550f90402e
commit 6b48ad28ce
2 changed files with 32 additions and 5 deletions

View File

@@ -133,12 +133,12 @@ type
const
MAX_LOCATIONS_HISTORY = 50;
HOMEDIR = '../../../../'; // share the cache in both example projects
MAP_PROVIDER_FILENAME = 'map-providers.xml';
USE_DMS = true;
var
PointFormatSettings: TFormatsettings;
CacheDir: String = '../../../../'; // share the cache in both example projects
function CalcIniName: String;
@@ -333,13 +333,22 @@ begin
end;
procedure TMainForm.FormCreate(Sender: TObject);
var
fn: String;
begin
cInputQueryEditSizePercents := 0;
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
POIImage := TPortableNetworkGraphic.Create;
POIImage.PixelFormat := pf32bit;
POIImage.LoadFromFile('../../mapmarker.png');
fn := Application.Location + 'mapmarker.png';
if not FileExists(fn) then
MessageDlg('Copy the file "mapmarker.png" from the source to the app binary directory.',
mtError, [mbOK], 0)
else
begin
// FMapMarker := CreateMapMarker(32, clRed, clBlack);
POIImage := TPortableNetworkGraphic.Create;
POIImage.PixelFormat := pf32bit;
POIImage.LoadFromFile(fn);
end;
ForceDirectories(HOMEDIR + 'cache/');
MapView.CachePath := HOMEDIR + 'cache/';