Mahmudm commited on
Commit
f820b24
·
verified ·
1 Parent(s): b005955

Update ash_animator/basemaps.py

Browse files
Files changed (1) hide show
  1. ash_animator/basemaps.py +3 -11
ash_animator/basemaps.py CHANGED
@@ -5,18 +5,10 @@ import contextily as ctx
5
  from mpl_toolkits.basemap import Basemap
6
 
7
 
8
- # Determine platform-appropriate, writable cache directory
9
  def get_cache_dir(app_name):
10
- if os.name == 'nt': # Windows
11
- return os.path.join(os.getenv('LOCALAPPDATA', tempfile.gettempdir()), f"{app_name}_cache")
12
- elif os.name == 'posix': # Linux/macOS
13
- home_dir = os.path.expanduser("~")
14
- if os.path.isdir(home_dir) and os.access(home_dir, os.W_OK):
15
- return os.path.join(home_dir, f".{app_name}_cache")
16
- else:
17
- return os.path.join(tempfile.gettempdir(), f"{app_name}_cache")
18
- else:
19
- return os.path.join(tempfile.gettempdir(), f"{app_name}_cache")
20
 
21
  # Define and create cache directories
22
  CTX_TILE_CACHE_DIR = get_cache_dir("contextily")
 
5
  from mpl_toolkits.basemap import Basemap
6
 
7
 
8
+ # Determine cache directory based on location of app.py
9
  def get_cache_dir(app_name):
10
+ base_dir = os.path.dirname(os.path.abspath(__file__))
11
+ return os.path.join(base_dir, f"{app_name}_cache")
 
 
 
 
 
 
 
 
12
 
13
  # Define and create cache directories
14
  CTX_TILE_CACHE_DIR = get_cache_dir("contextily")