Skip to content
Snippets Groups Projects
Commit 6f53879a authored by Vilém Duha's avatar Vilém Duha
Browse files

BlenderKit: fix a problem with global dict

wasn't found if the path changed and this broke registration of addon.
parent 876acc1c
No related branches found
No related tags found
No related merge requests found
......@@ -84,12 +84,21 @@ def get_temp_dir(subdir=None):
tempdir = os.path.join(user_preferences.global_dir, 'temp')
if tempdir.startswith('//'):
tempdir = bpy.path.abspath(tempdir)
if not os.path.exists(tempdir):
os.makedirs(tempdir)
if subdir is not None:
tempdir = os.path.join(tempdir, subdir)
try:
if not os.path.exists(tempdir):
os.makedirs(tempdir)
if subdir is not None:
tempdir = os.path.join(tempdir, subdir)
if not os.path.exists(tempdir):
os.makedirs(tempdir)
except:
print('Cache directory not found. Resetting Cache folder path.')
p = default_global_dict()
if p == user_preferences.global_dir:
print('Global dir was already default, plese set a global directory in addon preferences to a dir where you have write permissions.')
return None
user_preferences.global_dir = p
tempdir = get_temp_dir(subdir = subdir)
return tempdir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment