WM: avoid string replace w/ appconfig-activate
authorCampbell Barton <ideasman42@gmail.com>
Mon, 12 Nov 2018 19:59:23 +0000 (06:59 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 12 Nov 2018 20:02:51 +0000 (07:02 +1100)
Better construct an exact path, this would fail if the path exists
multiple times in the string.

release/scripts/startup/bl_operators/wm.py

index 381e98c29408194cd4b31acb2f99060088d5c12e..53735ed3ece8b923082fb980ddb3de6580b9cd59 100644 (file)
@@ -1417,10 +1417,10 @@ class WM_OT_appconfig_activate(Operator):
 
     def execute(self, context):
         import os
-        bpy.utils.keyconfig_set(self.filepath)
-
-        filepath = self.filepath.replace("keyconfig", "interaction")
-
+        filepath = self.filepath
+        bpy.utils.keyconfig_set(filepath)
+        dirname, filename = os.path.split(filepath)
+        filepath = os.path.normpath(os.path.join(dirname, os.pardir, "interaction", filename))
         if os.path.exists(filepath):
             bpy.ops.script.execute_preset(
                 filepath=filepath,