Change Cache Path

Topics: General
Sep 7, 2012 at 10:09 AM


I found that GMAP.NET creates a temp folder (GMap.NET) in the %USERPROFILE%\AppData\Local, for cache. How do I change that path?

Thanks for the tip/help in advance.

Sep 7, 2012 at 10:48 AM

map.CacheLocation = ...

Sep 7, 2012 at 10:49 AM

Thanks ;)

Sep 7, 2012 at 2:23 PM

I have added the code in the load-event of the map, but it keeps creating the folder GMap.NET, with the folders "DllCache" + subfolder and System.Data.SQLite.DLL and the folder "TileDBv5" + + subfolder and Data.gmdb...

Sep 7, 2012 at 2:29 PM


Sep 7, 2012 at 2:31 PM

It shouldn't. I changed the path of the cache to C:\example, but it keeps creating the folder GMap.NET in the userprofile\...etc.

Sep 7, 2012 at 2:35 PM

load event is too late, set it in the constructor as usual

Sep 7, 2012 at 2:52 PM

Public map_cache As String = "C:\test"

Public Sub New()

        ' This call is required by the designer.

        ' Add any initialization after the InitializeComponent() call.

        '   set the path of the map-cache
        '   first create the folder if it doesn't exist
        If Not Directory.Exists(map_cache) Then
        End If

        map.CacheLocation = map_cache
        besl_map.CacheLocation = map_cache
    End Sub
The folder GMap.NET is back again...???

Sep 7, 2012 at 3:42 PM

damn, it's a bug, setting location triggers default folders too, i'll fix it

..anyway why do you want to change default location?

Sep 7, 2012 at 4:00 PM

Thanks for the fix in advance.

It's not that really interesting, but I use more temp files in my app. This way I can add the folder for the map also the app-tempfolder, just to keep things clean. Like I said, not very interesting ;)

Sep 7, 2012 at 4:57 PM

done ;}

p.s. sqlite dll are saved in default directory

Sep 7, 2012 at 5:00 PM


What do you mean with "default directory"? What is the default-directory?

Sep 7, 2012 at 5:30 PM


Sep 7, 2012 at 5:39 PM

-Well, that was actually what I was trying to avoid. I want to have every file/(sub)folder to be located in my app-temp-.path. Without that I don't see any purpose using the CacheLocation.

Sep 7, 2012 at 6:27 PM

cache is for map cache, application files deosn't belong there

Sep 7, 2012 at 6:28 PM

Ah. Okay, I understand. Any way to have that folder/file located in the application path?

Sep 7, 2012 at 7:00 PM

manualy changing the source

Sep 7, 2012 at 7:02 PM

Okay, will do that. Any way to have this as standard behaviour?

Sep 7, 2012 at 7:07 PM

but why do you need these dll in your map cache folder?

Sep 7, 2012 at 7:09 PM

No, no, no. Sorry for being confusing. The dll's can be located in the application path. Means, instead of adding the dll's in the userprofile, why not simply in the application.startuppath.

Sep 7, 2012 at 7:24 PM

it wont work if you use AnyCPU target, sqlite dll is native and doesn't work when you have different cpu/.net version... long story, it was pain in the ass

i've fixed the mess by extracting required version automatically therefore user doesn't need to to experience the configuration process...


Sep 7, 2012 at 7:42 PM
Edited Sep 7, 2012 at 7:43 PM

Thanks for the info. Clear now. Was hoping it would be simple :P

Any change to let the user set his/her own folder for that in the %USERPROFILE%? If not, I understand.

EDIT: Also less coding in INNOSETUP for uninstall-procedure. :P

Sep 7, 2012 at 8:03 PM

SQLitePureImageCache.cs, CurrentDomain_AssemblyResolve:

string rootDir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "GMap.NET" + Path.DirectorySeparatorChar;

replace to =>

string rootDir = GMap.NET.Internals.CacheLocator.Location + Path.DirectorySeparatorChar;