From 430868e85934a5a048ff75a9549f316943b1dec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 3 Nov 2017 16:04:52 +0100 Subject: [PATCH] Make THEME_STATIC_PATHS work for files as well. The test passes now. --- pelican/generators.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index eb97c115..3a8909e4 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -696,14 +696,21 @@ class StaticGenerator(Generator): final_path=None): """Copy all the paths from source to destination""" for path in paths: + source_path = os.path.join(source, path) + if final_path: - copy(os.path.join(source, path), - os.path.join(output_path, destination, final_path), - self.settings['IGNORE_FILES']) + if os.path.isfile(source_path): + destination_path = os.path.join(output_path, destination, + final_path, + os.path.basename(path)) + else: + destination_path = os.path.join(output_path, destination, + final_path) else: - copy(os.path.join(source, path), - os.path.join(output_path, destination, path), - self.settings['IGNORE_FILES']) + destination_path = os.path.join(output_path, destination, path) + + copy(source_path, destination_path, + self.settings['IGNORE_FILES']) def _file_update_required(self, staticfile): source_path = os.path.join(self.path, staticfile.source_path)