summaryrefslogtreecommitdiff
path: root/pywal/image.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-22 10:51:52 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-22 10:51:52 +1000
commit38afea4f2ef5a4a04ef44139aa1ed01f3655a797 (patch)
treec8e3bc5f4eba14643ef5d6d8fd1c8f6e4eedbea2 /pywal/image.py
parent3dd1fc9039822e4426d5dc8c3f807dd5f6f2d295 (diff)
General: move cache call
Diffstat (limited to 'pywal/image.py')
-rw-r--r--pywal/image.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pywal/image.py b/pywal/image.py
index a7a314d..421943e 100644
--- a/pywal/image.py
+++ b/pywal/image.py
@@ -24,7 +24,7 @@ def get_random_image(img_dir, cache_dir):
print("image: No new images found (nothing to do), exiting...")
quit(1)
- return img_dir / random.choice(images).name
+ return str(img_dir / random.choice(images).name)
def get_image(img, cache_dir):
@@ -32,7 +32,7 @@ def get_image(img, cache_dir):
image = pathlib.Path(img)
if image.is_file():
- wal_img = image
+ wal_img = str(image)
elif image.is_dir():
wal_img = get_random_image(image, cache_dir)
@@ -41,5 +41,8 @@ def get_image(img, cache_dir):
print("error: No valid image file found.")
exit(1)
+ # Cache the image file path.
+ util.save_file(wal_img, cache_dir / "wal")
+
print("image: Using image", wal_img)
- return str(wal_img)
+ return wal_img