From 8f4c340915fbfc65f9380b9a8561ed877c7dab87 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Feb 2010 14:08:22 +0000 Subject: bpy.utils.home_paths, use this to get script paths for the user/local/system blender paths. --- release/scripts/modules/bpy/utils.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 7f10be362df..3f7a38f87c9 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -27,6 +27,7 @@ import bpy as _bpy import os as _os import sys as _sys +from _bpy import home_paths def load_scripts(reload_scripts=False, refresh_scripts=False): import traceback @@ -171,17 +172,15 @@ def script_paths(*args): # add user scripts dir user_script_path = _bpy.context.user_preferences.filepaths.python_scripts_directory - - if not user_script_path: - # XXX - WIN32 needs checking, perhaps better call a blender internal function. - user_script_path = _os.path.join(_os.path.expanduser("~"), ".blender", "scripts") - - user_script_path = _os.path.normpath(user_script_path) - - if user_script_path not in scripts and _os.path.isdir(user_script_path): - scripts.append(user_script_path) + + for path in home_paths("scripts") + (user_script_path, ): + if path: + path = _os.path.normpath(path) + if path not in scripts and _os.path.isdir(path): + scripts.append(path) if not args: + print(scripts) return scripts subdir = _os.path.join(*args) @@ -190,7 +189,7 @@ def script_paths(*args): path_subdir = _os.path.join(path, subdir) if _os.path.isdir(path_subdir): script_paths.append(path_subdir) - + print(script_paths) return script_paths -- cgit v1.2.3