Skip to content

Commit

Permalink
Catch for setting the configfile to TMPDIR in homeless containers (Gi…
Browse files Browse the repository at this point in the history
…thub issue #226)
  • Loading branch information
marcelzwiers committed Feb 13, 2024
1 parent cd409e1 commit 0c3077a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bidscoin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import datetime
import shutil
import warnings
import tempfile
from pathlib import Path
from importlib import metadata
from typing import Tuple, Union, List
Expand Down Expand Up @@ -62,7 +63,8 @@
DEBUG = platform.os.getenv('BIDSCOIN_DEBUG','').upper() in ('1', 'TRUE', 'Y', 'YES')

# Create a BIDScoin user configuration directory if needed and load the BIDScoin user settings
configfile = Path(platform.os.getenv('BIDSCOIN_CONFIG') or Path.home()/'.bidscoin'/__version__/'config.toml')
configfile = Path(platform.os.getenv('BIDSCOIN_CONFIG') or
(Path.home() if Path.home().exists() else Path(tempfile.gettempdir()))/'.bidscoin'/__version__/'config.toml')
templatefolder = configfile.parent/'templates'
templatefolder.mkdir(parents=True, exist_ok=True)
if not configfile.is_file():
Expand Down

0 comments on commit 0c3077a

Please sign in to comment.