Skip to content

fix: resolve short color_scheme paths using find_resources#36

Open
gadflysu wants to merge 1 commit into
SublimeText:masterfrom
gadflysu:fix/color-scheme-resolution
Open

fix: resolve short color_scheme paths using find_resources#36
gadflysu wants to merge 1 commit into
SublimeText:masterfrom
gadflysu:fix/color-scheme-resolution

Conversation

@gadflysu

@gadflysu gadflysu commented Jun 9, 2026

Copy link
Copy Markdown

Problem

When color_scheme in Preferences is a bare filename (e.g. ayu-dark.sublime-color-scheme) — which is what Sublime Text writes when the user selects a scheme via the Command Palette — the plugin blindly prefixes it with Packages/Color Scheme - Default/. This path is wrong for any third-party theme, resulting in OSError: resource "Packages/Color Scheme - Default/ayu-dark.sublime-color-scheme" not found.

Fix

Use sublime.find_resources(filename) to let Sublime Text locate the file across all installed packages. Prefer results outside Packages/User/ since plugins such as SFTP and RainbowBrackets copy the active color scheme there and we want the canonical source. Fall back to the original prefix only when no match is found.

Related

Closes #22
Closes #30
Related to #9 (now closed, same root cause)

Previously, a bare filename like `ayu-dark.sublime-color-scheme` was
blindly prefixed with `Packages/Color Scheme - Default/`, causing an
OSError whenever the active scheme lives in a third-party package.

Use `sublime.find_resources()` to search all installed packages, and
prefer matches outside `Packages/User/` to avoid plugin-generated copies
(e.g. from SFTP or RainbowBrackets). Fall back to the original prefix
only when no match is found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

breaks on MarkDownEditor-Dark color scheme, maybe others. "resource not found"

1 participant