Skip to content

Commit 76fe4e8

Browse files
committed
Handle "PLATFORMIO_CACHE_DIR" environment variable
1 parent 57baaf1 commit 76fe4e8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pioinstaller/core.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,15 @@ def get_core_dir(force_to_root=False):
5757
return core_dir
5858

5959

60-
def get_cache_dir(path=None):
61-
core_dir = path or get_core_dir()
62-
path = os.path.join(core_dir, ".cache")
63-
if not os.path.isdir(path):
64-
os.makedirs(path)
65-
return path
60+
def get_cache_dir():
61+
cache_dir = (
62+
os.getenv("PLATFORMIO_CACHE_DIR")
63+
if os.getenv("PLATFORMIO_CACHE_DIR")
64+
else os.path.join(get_core_dir(), ".cache")
65+
)
66+
if not os.path.isdir(cache_dir):
67+
os.makedirs(cache_dir)
68+
return cache_dir
6669

6770

6871
def install_platformio_core(shutdown_piohome=True, develop=False, ignore_pythons=None):

0 commit comments

Comments
 (0)