mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-02-26 23:21:14 +01:00
Merge pull request #617 from scaryrawr/windows-path-json
fix: Wallpaper path on Windows isn't JSON compliant
This commit is contained in:
commit
a32a987304
@ -18,11 +18,19 @@ def list_backends():
|
|||||||
os.scandir(os.path.join(MODULE_DIR, "backends"))
|
os.scandir(os.path.join(MODULE_DIR, "backends"))
|
||||||
if "__" not in b.name]
|
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):
|
def colors_to_dict(colors, img):
|
||||||
"""Convert list of colors to pywal format."""
|
"""Convert list of colors to pywal format."""
|
||||||
return {
|
return {
|
||||||
"wallpaper": img,
|
"wallpaper": normalize_img_path(img),
|
||||||
"alpha": util.Color.alpha_num,
|
"alpha": util.Color.alpha_num,
|
||||||
|
|
||||||
"special": {
|
"special": {
|
||||||
|
Loading…
Reference in New Issue
Block a user