Commit 8ba6ba8d7391745eb4d71f3a2e7ffc53a9c1af6f
1 parent
4f679b6b
Exists in
master
added TEMP_DIR in inv_paths
Showing
2 changed files
with
3 additions
and
6 deletions
Show diff stats
invesalius/inv_paths.py
| ... | ... | @@ -2,6 +2,7 @@ import os |
| 2 | 2 | import pathlib |
| 3 | 3 | import shutil |
| 4 | 4 | import sys |
| 5 | +import tempfile | |
| 5 | 6 | |
| 6 | 7 | USER_DIR = pathlib.Path().home() |
| 7 | 8 | CONF_DIR = pathlib.Path(os.environ.get("XDG_CONFIG_HOME", USER_DIR.joinpath(".config"))) |
| ... | ... | @@ -9,6 +10,7 @@ USER_INV_DIR = CONF_DIR.joinpath("invesalius") |
| 9 | 10 | USER_PRESET_DIR = USER_INV_DIR.joinpath("presets") |
| 10 | 11 | USER_LOG_DIR = USER_INV_DIR.joinpath("logs") |
| 11 | 12 | USER_RAYCASTING_PRESETS_DIRECTORY = USER_PRESET_DIR.joinpath("raycasting") |
| 13 | +TEMP_DIR = tempfile.gettempdir() | |
| 12 | 14 | |
| 13 | 15 | OLD_USER_INV_DIR = USER_DIR.joinpath(".invesalius") |
| 14 | 16 | OLD_USER_PRESET_DIR = OLD_USER_INV_DIR.joinpath("presets") | ... | ... |
invesalius/session.py
| ... | ... | @@ -88,11 +88,6 @@ class Session(with_metaclass(Singleton, object)): |
| 88 | 88 | |
| 89 | 89 | def CreateItens(self): |
| 90 | 90 | import invesalius.constants as const |
| 91 | - homedir = inv_paths.USER_DIR | |
| 92 | - tempdir = os.path.join(inv_paths.USER_DIR, u".invesalius", u"temp") | |
| 93 | - if not os.path.isdir(tempdir): | |
| 94 | - os.makedirs(tempdir) | |
| 95 | - | |
| 96 | 91 | self._values = collections.defaultdict(dict, { |
| 97 | 92 | 'session': { |
| 98 | 93 | 'mode': const.MODE_RP, |
| ... | ... | @@ -111,7 +106,7 @@ class Session(with_metaclass(Singleton, object)): |
| 111 | 106 | |
| 112 | 107 | 'paths': { |
| 113 | 108 | 'homedir': str(inv_paths.USER_DIR), |
| 114 | - 'tempdir': os.path.join(homedir, u".invesalius", u"temp"), | |
| 109 | + 'tempdir': str(inv_paths.TEMP_DIR), | |
| 115 | 110 | 'last_dicom_folder': '', |
| 116 | 111 | }, |
| 117 | 112 | }) | ... | ... |