Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2019-11-01 19:48:57 +0300
committerSebastian Parborg <darkdefende@gmail.com>2019-11-01 19:58:29 +0300
commitca56fe6d91abb8fb252fab023446cfbf4c3ae5d8 (patch)
treee813ac681aebde493330d9bef96c0ee55aa7387c /release
parent88833170f221b164f0d5c5edacf112d8769730b9 (diff)
Fix python error when trying to delete presets
In some cases the default data paths for blender does not exist. For example on windows when using the portable install. This would lead to errors when trying to lookup default paths in is_path_builtin. Now we handle cases like this gracefully.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy/utils/__init__.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 74cc54bb544..abe33b0e8ea 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -469,7 +469,6 @@ def is_path_builtin(path):
# it's intended to be used to check if it's OK to remove presets.
#
# If this is used in a draw-loop for example, we could cache some of the values.
- search_path = _os.path.abspath(path)
user_path = resource_path('USER')
for res in ('SYSTEM', 'LOCAL'):
@@ -480,11 +479,15 @@ def is_path_builtin(path):
# This can happen on portable installs.
continue
- if _os.path.samefile(
- _os.path.commonpath([parent_path]),
- _os.path.commonpath([parent_path, path])
- ):
- return True
+ try:
+ if _os.path.samefile(
+ _os.path.commonpath([parent_path]),
+ _os.path.commonpath([parent_path, path])
+ ):
+ return True
+ except FileNotFoundError:
+ #The path we tried to look up doesn't exist
+ pass
return False