[commit: ghc] wip/nfs-locking: Don't add redundant path separator in -/- (d1780e4)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 00:31:22 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/d1780e499e3e5a3f4adb21f6be366b26ae3ec6a4/ghc
>---------------------------------------------------------------
commit d1780e499e3e5a3f4adb21f6be366b26ae3ec6a4
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Mon May 16 01:31:02 2016 +0100
Don't add redundant path separator in -/-
>---------------------------------------------------------------
d1780e499e3e5a3f4adb21f6be366b26ae3ec6a4
src/Base.hs | 5 ++++-
src/Oracles/WindowsPath.hs | 5 +++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/Base.hs b/src/Base.hs
index bd80f47..339a61d 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -89,7 +89,10 @@ unifyPath = toStandard . normaliseEx
-- | Combine paths with a forward slash regardless of platform.
(-/-) :: FilePath -> FilePath -> FilePath
-a -/- b = a ++ '/' : b
+"" -/- b = b
+a -/- b
+ | last a == '/' = a ++ b
+ | otherwise = a ++ '/' : b
infixr 6 -/-
diff --git a/src/Oracles/WindowsPath.hs b/src/Oracles/WindowsPath.hs
index 2a3336d..3cbf73b 100644
--- a/src/Oracles/WindowsPath.hs
+++ b/src/Oracles/WindowsPath.hs
@@ -3,7 +3,8 @@ module Oracles.WindowsPath (
fixAbsolutePathOnWindows, topDirectory, windowsPathOracle
) where
-import Data.Char (isSpace)
+import Data.Char
+
import Base
import Oracles.Config.Setting
@@ -25,7 +26,7 @@ fixAbsolutePathOnWindows path = do
then do
let (dir, file) = splitFileName path
winDir <- askOracle $ WindowsPath dir
- return $ winDir ++ file
+ return $ winDir -/- file
else
return path
More information about the ghc-commits
mailing list