[Bf-extensions-cvs] [6f53879a] master: BlenderKit: fix a problem with global dict
Vilém Duha
noreply at git.blender.org
Fri Apr 3 02:33:18 CEST 2020
Commit: 6f53879aaa9d0ca9691761609109be11b0daaf92
Author: Vilém Duha
Date: Fri Apr 3 02:31:19 2020 +0200
Branches: master
https://developer.blender.org/rBA6f53879aaa9d0ca9691761609109be11b0daaf92
BlenderKit: fix a problem with global dict
wasn't found if the path changed and this broke registration of addon.
===================================================================
M blenderkit/paths.py
===================================================================
diff --git a/blenderkit/paths.py b/blenderkit/paths.py
index 112e2465..daf56b96 100644
--- a/blenderkit/paths.py
+++ b/blenderkit/paths.py
@@ -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
More information about the Bf-extensions-cvs
mailing list