From d4c181fa477f6270067e313dff7e1dc339cda800 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 20 Jun 2017 14:43:41 +1000 Subject: [PATCH] General: Cleanup --- wal | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/wal b/wal index 164dc90..df99d7f 100755 --- a/wal +++ b/wal @@ -19,7 +19,7 @@ __version__ = "0.1" # Internal variables. COLOR_COUNT = 16 -CACHE_DIR = pathlib.Path("%s%s" % (os.path.expanduser("~"), "/.cache/wal/")) +CACHE_DIR = pathlib.Path.home() / ".cache/wal/" class ColorFormats(object): # pylint: disable=too-few-public-methods @@ -78,6 +78,7 @@ def process_args(args): # -c if args.c: shutil.rmtree(CACHE_DIR / "schemes") + create_cache_dir() # -r if args.r: @@ -86,8 +87,6 @@ def process_args(args): # -i if args.i: image = str(get_image(args.i)) - - # Get the colors. colors = get_colors(image) # Set the wallpaper. @@ -465,13 +464,17 @@ def save_file(colors, export_file): file.write(colors) +def create_cache_dir(): + """Alias to create the cache dir.""" + pathlib.Path(CACHE_DIR / "schemes").mkdir(parents=True, exist_ok=True) + + # }}} def main(): """Main script function.""" - # Create colorscheme dir. - pathlib.Path(CACHE_DIR / "schemes").mkdir(parents=True, exist_ok=True) + create_cache_dir() # Get the args. args = get_args()