Merge pull request #160 from MPavleski/windows_relative_path_fix

Fix for the relative check in Windows which fails due invoking relati…
This commit is contained in:
Simon Conseil
2015-05-28 22:48:16 +02:00

View File

@@ -117,8 +117,17 @@ def build(source, destination, debug, verbose, force, config, theme, title,
logger.error("Input directory not found: %s", settings['source'])
sys.exit(1)
if not os.path.relpath(settings['destination'],
settings['source']).startswith('..'):
# on windows os.path.relpath raises a ValueError if the two paths are on
# different drives, in that case we just ignore the exception as the two
# paths are anyway not relative
relative_check = True
try:
relative_check = os.path.relpath(settings['destination'],
settings['source']).startswith('..')
except ValueError:
pass
if not relative_check:
logger.error("Output directory should be outside of the input "
"directory.")
sys.exit(1)