Commit 8ba6ba8d7391745eb4d71f3a2e7ffc53a9c1af6f

Authored by Thiago Franco de Moraes
1 parent 4f679b6b
Exists in master

added TEMP_DIR in inv_paths

invesalius/inv_paths.py
@@ -2,6 +2,7 @@ import os @@ -2,6 +2,7 @@ import os
2 import pathlib 2 import pathlib
3 import shutil 3 import shutil
4 import sys 4 import sys
  5 +import tempfile
5 6
6 USER_DIR = pathlib.Path().home() 7 USER_DIR = pathlib.Path().home()
7 CONF_DIR = pathlib.Path(os.environ.get("XDG_CONFIG_HOME", USER_DIR.joinpath(".config"))) 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,6 +10,7 @@ USER_INV_DIR = CONF_DIR.joinpath("invesalius")
9 USER_PRESET_DIR = USER_INV_DIR.joinpath("presets") 10 USER_PRESET_DIR = USER_INV_DIR.joinpath("presets")
10 USER_LOG_DIR = USER_INV_DIR.joinpath("logs") 11 USER_LOG_DIR = USER_INV_DIR.joinpath("logs")
11 USER_RAYCASTING_PRESETS_DIRECTORY = USER_PRESET_DIR.joinpath("raycasting") 12 USER_RAYCASTING_PRESETS_DIRECTORY = USER_PRESET_DIR.joinpath("raycasting")
  13 +TEMP_DIR = tempfile.gettempdir()
12 14
13 OLD_USER_INV_DIR = USER_DIR.joinpath(".invesalius") 15 OLD_USER_INV_DIR = USER_DIR.joinpath(".invesalius")
14 OLD_USER_PRESET_DIR = OLD_USER_INV_DIR.joinpath("presets") 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,11 +88,6 @@ class Session(with_metaclass(Singleton, object)):
88 88
89 def CreateItens(self): 89 def CreateItens(self):
90 import invesalius.constants as const 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 self._values = collections.defaultdict(dict, { 91 self._values = collections.defaultdict(dict, {
97 'session': { 92 'session': {
98 'mode': const.MODE_RP, 93 'mode': const.MODE_RP,
@@ -111,7 +106,7 @@ class Session(with_metaclass(Singleton, object)): @@ -111,7 +106,7 @@ class Session(with_metaclass(Singleton, object)):
111 106
112 'paths': { 107 'paths': {
113 'homedir': str(inv_paths.USER_DIR), 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 'last_dicom_folder': '', 110 'last_dicom_folder': '',
116 }, 111 },
117 }) 112 })