From 2692586abe8fe9fe6ec6c4d422b5306a8e6523ea Mon Sep 17 00:00:00 2001 From: Irfan Ahmad Date: Wed, 19 Dec 2012 17:06:44 +0500 Subject: [PATCH] Fixes #645 - Making cross-content linking windows compatible --- pelican/contents.py | 3 +++ pelican/generators.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pelican/contents.py b/pelican/contents.py index de2b7512..c33511c1 100644 --- a/pelican/contents.py +++ b/pelican/contents.py @@ -340,6 +340,9 @@ class StaticContent(object): settings = copy.deepcopy(_DEFAULT_CONFIG) self.src = src self.url = dst or src + # On Windows, make sure we end up with Unix-like paths. + if os.name == 'nt': + self.url = self.url.replace('\\', '/') self.source_path = os.path.join(settings['PATH'], src) self.save_as = os.path.join(settings['OUTPUT_PATH'], self.url) diff --git a/pelican/generators.py b/pelican/generators.py index e3ebf994..606a1aa7 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -510,6 +510,9 @@ class StaticGenerator(Generator): for f in self.get_files( os.path.join(self.path, static_path), extensions=False): f_rel = os.path.relpath(f, self.path) + # On Windows, make sure we end up with Unix-like paths. + if os.name == 'nt': + f_rel = f_rel.replace('\\', '/') # TODO remove this hardcoded 'static' subdirectory sc = StaticContent(f_rel, os.path.join('static', f_rel), settings=self.settings)