1
0
Fork 0
forked from github/pelican

Fixes #645 - Making cross-content linking windows compatible

This commit is contained in:
Irfan Ahmad 2012-12-19 17:06:44 +05:00 committed by Alexis Métaireau
commit 2692586abe
2 changed files with 6 additions and 0 deletions

View file

@ -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)

View file

@ -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)