diff options
| author | dylan <dylan.araps@gmail.com> | 2021-08-12 05:06:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-12 05:06:19 +0000 |
| commit | a32a987304733934b53aa4ec76c61f19a142fe4a (patch) | |
| tree | 3ecf0f2aa1df4c0a1e4f659a3228010e283f2586 | |
| parent | 4997a49eb7479ccda1228f064d6c50e1abedc5b4 (diff) | |
| parent | 63a65055f9b7d8009ce84994cc81b072d617fb69 (diff) | |
Merge pull request #617 from scaryrawr/windows-path-json
fix: Wallpaper path on Windows isn't JSON compliant
| -rw-r--r-- | pywal/colors.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pywal/colors.py b/pywal/colors.py index 99d346d..fd8033f 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -18,11 +18,19 @@ def list_backends(): os.scandir(os.path.join(MODULE_DIR, "backends")) if "__" not in b.name] +def normalize_img_path(img: str): + """Normalizes the image path for output.""" + if os.name == 'nt': + # On Windows, the JSON.dump ends up outputting un-escaped backslash breaking + # the ability to read colors.json. Windows supports forward slash, so we can + # use that for now + return img.replace('\\', '/') + return img def colors_to_dict(colors, img): """Convert list of colors to pywal format.""" return { - "wallpaper": img, + "wallpaper": normalize_img_path(img), "alpha": util.Color.alpha_num, "special": { |
