Skip to content

Commit 7564033

Browse files
committed
write out modified theme to „Packages/User“
instead of modifying in-place, which may brake if the theme resides in a compressed package
1 parent 99a53ef commit 7564033

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

sublime_python_colors.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,18 @@ def generate_color_scheme_async():
111111
return
112112

113113
# write new theme
114-
scheme_path = os.path.join(os.path.split(sublime.packages_path())[0], scheme)
114+
original_name = os.path.splitext(os.path.basename(scheme))[0]
115+
new_name = original_name + ' (SublimePythonIDE).tmTheme'
116+
scheme_path = os.path.join(sublime.packages_path(), 'User', new_name)
115117

116118
with open(scheme_path, 'w', encoding='utf8') as f:
117119
f.write(COLOR_SCHEME_PREAMBLE)
118120
f.write(ElementTree.tostring(plist, encoding='unicode'))
119121

120-
prefs.set('color_scheme', scheme)
122+
# ST does not expect platform specific paths here, but only
123+
# forward-slash separated paths relative to "Packages"
124+
new_theme_setting = "/".join(['Packages', 'User', new_name])
125+
prefs.set('color_scheme', new_theme_setting)
121126
sublime.save_settings("Preferences.sublime-settings")
122127

123128
# run async

0 commit comments

Comments
 (0)