diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-01-29 00:52:07 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-01-29 00:52:07 +0300 |
commit | 21b7556bf757bdae0e0f2af3437f57345358aa9f (patch) | |
tree | 28295b68ae8fa91a82799f6a5f0e78d72b2cadf3 /release/scripts | |
parent | 462e7cdb47e643adff5d104b9271144d1ff80aa1 (diff) |
Add cfg folder for keyconfigs (and possibly others later) to be imported after everything else.
Also remove .pyc file when removing keyconfigs.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref.py | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 383d2be0780..38de95aa6e4 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -72,7 +72,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False): test_reload(_sys.modules[module_name]) for base_path in script_paths(): - for path_subdir in ("ui", "op", "io"): + for path_subdir in ("ui", "op", "io", "cfg"): path = _os.path.join(base_path, path_subdir) if _os.path.isdir(path): diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 52b8d6583ea..292d855b96c 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -1502,12 +1502,14 @@ class WM_OT_keyconfig_import(bpy.types.Operator): f.close() - path = bpy.context.user_preferences.filepaths.python_scripts_directory + path = os.path.split(os.path.split(__file__)[0])[0] # remove ui/space_userpref.py + path = os.path.join(path, "cfg") - if not path: - path = os.path.split(__file__)[0] - - path += os.path.sep + config_name + ".py" + # create config folder if needed + if not os.path.exists(path): + os.mkdir(path) + + path = os.path.join(path, config_name + ".py") if self.properties.keep_original: shutil.copy(self.properties.path, path) @@ -1717,6 +1719,11 @@ class WM_OT_keyconfig_remove(bpy.types.Operator): module = __import__(keyconfig.name) os.remove(module.__file__) + + compiled_path = module.__file__ + "c" # for .pyc + + if os.path.exists(compiled_path): + os.remove(compiled_path) wm.remove_keyconfig(keyconfig) return {'FINISHED'} |