diff --git a/MapControl/Shared/GroundOverlay.cs b/MapControl/Shared/GroundOverlay.cs index 540f6b99..ff099ae9 100644 --- a/MapControl/Shared/GroundOverlay.cs +++ b/MapControl/Shared/GroundOverlay.cs @@ -131,7 +131,8 @@ namespace MapControl { using (var archive = await Task.Run(() => ZipFile.OpenRead(archiveFilePath))) { - var docEntry = await Task.Run(() => archive.GetEntry("doc.kml") ?? archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml"))); + var docEntry = await Task.Run(() => archive.GetEntry("doc.kml") + ?? archive.Entries.FirstOrDefault(e => e.Name.EndsWith(".kml"))); if (docEntry == null) { @@ -173,7 +174,8 @@ namespace MapControl private static async Task> ReadGroundOverlaysFromFileAsync(string docFilePath) { - docFilePath = Path.GetFullPath(docFilePath); + docFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, docFilePath); + var docUri = new Uri(docFilePath); var imageOverlays = await Task.Run(() => diff --git a/MapControl/WinUI/GeoImage.WinUI.cs b/MapControl/WinUI/GeoImage.WinUI.cs index ab08564e..015f4b46 100644 --- a/MapControl/WinUI/GeoImage.WinUI.cs +++ b/MapControl/WinUI/GeoImage.WinUI.cs @@ -20,7 +20,8 @@ namespace MapControl { public static async Task> ReadGeoTiff(string sourcePath) { - var file = await StorageFile.GetFileFromPathAsync(Path.GetFullPath(sourcePath)); + var file = await StorageFile.GetFileFromPathAsync( + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, sourcePath)); using (var stream = await file.OpenReadAsync()) { diff --git a/MapControl/WinUI/ImageLoader.WinUI.cs b/MapControl/WinUI/ImageLoader.WinUI.cs index f242783a..52b060df 100644 --- a/MapControl/WinUI/ImageLoader.WinUI.cs +++ b/MapControl/WinUI/ImageLoader.WinUI.cs @@ -50,9 +50,11 @@ namespace MapControl { ImageSource image = null; + path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path); + if (File.Exists(path)) { - var file = await StorageFile.GetFileFromPathAsync(Path.GetFullPath(path)); + var file = await StorageFile.GetFileFromPathAsync(path); using (var stream = await file.OpenReadAsync()) {