Skip to content

Commit

Permalink
Resolve haskell#7065: Encode file+noindex paths as URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
phadej committed Sep 14, 2020
1 parent 90c4695 commit 846fce4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,6 @@ infixr 4 `archiveTo`
-- external repository corresponding to all of these packages
withRepo :: FilePath -> TestM a -> TestM a
withRepo repo_dir m = do
-- https://github.com/haskell/cabal/issues/7065
-- you don't simply put a windows path into URL...
skipIfWindows

env <- getTestEnv

-- 1. Initialize repo directory
Expand Down Expand Up @@ -531,7 +527,14 @@ withRepo repo_dir m = do
withReaderT (\env' -> env' { testHaveRepo = True }) m
-- TODO: Arguably should undo everything when we're done...
where
repoUri env ="file+noindex://" ++ testRepoDir env
repoUri
-- encode path as UNC path on windows.
| buildOS == Windows = "file+noindex:///" ++ convertDirSeparators (testRepoDir env)
| otherwise env = "file+noindex://" ++ testRepoDir env

convertDirSeparators = map $ \c -> case c of
'\\' -> '/'
c -> c

------------------------------------------------------------------------
-- * Subprocess run results
Expand Down

0 comments on commit 846fce4

Please sign in to comment.