bpy.utils.home_paths, use this to get script paths for the user/local/system blender paths.

This commit is contained in:
2010-02-11 14:08:22 +00:00
parent a2b94de539
commit 8f4c340915
5 changed files with 177 additions and 96 deletions

View File

@@ -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