Skip to content

Commit 8c1bc85

Browse files
committed
Refactor get_binary_cache_dir to support custom SLING_HOME_DIR environment variable
1 parent ceea49b commit 8c1bc85

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

sling/sling/bin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@ def get_platform_info():
3232

3333
def get_binary_cache_dir(version: str):
3434
"""Get the directory where binaries are cached"""
35-
cache_dir = Path.home() / '.sling' / 'bin' / 'sling' / version
35+
# Check for SLING_HOME_DIR environment variable, otherwise use default
36+
sling_home = os.getenv('SLING_HOME_DIR')
37+
if sling_home:
38+
home_dir = Path(sling_home)
39+
else:
40+
home_dir = Path.home() / '.sling'
41+
cache_dir = home_dir / 'bin' / 'sling' / version
3642
cache_dir.mkdir(parents=True, exist_ok=True)
3743
return cache_dir
3844

0 commit comments

Comments
 (0)