summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Path.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Utility/Path.hs b/Utility/Path.hs
index 2675aa0f9..72d43784f 100644
--- a/Utility/Path.hs
+++ b/Utility/Path.hs
@@ -138,9 +138,15 @@ relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to
{- This requires the first path to be absolute, and the
- second path cannot contain ../ or ./
+ -
+ - On Windows, if the paths are on different drives,
+ - a relative path is not possible and the path is simply
+ - returned as-is.
-}
relPathDirToFileAbs :: FilePath -> FilePath -> FilePath
-relPathDirToFileAbs from to = join s $ dotdots ++ uncommon
+relPathDirToFileAbs from to
+ | takeDrive from /= takeDrive to = to
+ | otherwise = join s $ dotdots ++ uncommon
where
s = [pathSeparator]
pfrom = split s from