From b9bf74f89b1d10d8f8e54863bf5442d612c85fdd Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 24 Jul 2017 22:29:20 +1000 Subject: general: Rename constants --- pywal/export.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'pywal/export.py') diff --git a/pywal/export.py b/pywal/export.py index 316de7b..f727466 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -4,13 +4,10 @@ Export colors in various formats. import os import pathlib -from .settings import __cache_dir__ +from .settings import CACHE_DIR, MODULE_DIR from . import util -TEMPLATE_DIR = pathlib.Path(__file__).parent / "templates" - - def template(colors, input_file, output_file=None): """Read template file, substitute markers and save the file elsewhere.""" @@ -42,12 +39,12 @@ def get_export_type(export_type): }.get(export_type, export_type) -def every(colors, output_dir=__cache_dir__): +def every(colors, output_dir=CACHE_DIR): """Export all template files.""" all_colors = flatten_colors(colors) output_dir = pathlib.Path(output_dir) - for file in os.scandir(TEMPLATE_DIR): + for file in os.scandir(MODULE_DIR / "templates"): template(all_colors, file.path, output_dir / file.name) print(f"export: Exported all files.") @@ -58,8 +55,8 @@ def color(colors, export_type, output_file=None): all_colors = flatten_colors(colors) template_name = get_export_type(export_type) - template_file = TEMPLATE_DIR / template_name - output_file = output_file or __cache_dir__ / template_name + template_file = MODULE_DIR / "templates" / template_name + output_file = output_file or CACHE_DIR / template_name if template_file.is_file(): template(all_colors, template_file, output_file) -- cgit v1.2.3