summaryrefslogtreecommitdiff
path: root/pywal/export.py
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-24 22:29:20 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-24 22:29:20 +1000
commitb9bf74f89b1d10d8f8e54863bf5442d612c85fdd (patch)
treef52225414b33ad7b33f17f090faf5954a9b8ab7a /pywal/export.py
parent4fecce6e9c326970a73f8f3a599be8a02aeea381 (diff)
general: Rename constants
Diffstat (limited to 'pywal/export.py')
-rw-r--r--pywal/export.py13
1 files changed, 5 insertions, 8 deletions
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)