git.iko.soy/typeable/cabal2nix
on master help sign in
Check if path contains slashes after stripping

If we do `cabal2nix test/`, we need to add a `./` prefix because the path doesn't contain any slashes after stripping.

commitd0beccf1c23dd5d5121bf5fa39e7b0249d31c84a authorBenno Fünfstück <benno.fuenfstueck@gmail.com> dateMon 25 Aug 2014, 15:00 (12 years ago) parentaa25762
1 file changed+2−2
src/Distribution/NixOS/Fetch.hs+2−2
src/Distribution/NixOS/Fetch.hs+2−2
@@ -63,11 +63,11 @@ fetch f = runMaybeT . fetchers where
6363
6464 fetchLocal :: Source -> MaybeT IO (DerivationSource, a)
6565 fetchLocal src = do
66− let path = stripPrefix "file://" $ sourceUrl src
66+ let path = stripSlashSuffix $ stripPrefix "file://" $ sourceUrl src
6767 existsFile <- liftIO $ doesFileExist path
6868 existsDir <- liftIO $ doesDirectoryExist path
6969 guard $ existsDir || existsFile
70− let path' | '/' `elem` path = stripSlashSuffix path
70+ let path' | '/' `elem` path = path
7171 | otherwise = "./" ++ path
7272 process (DerivationSource "" path' "" "", path') <|> localArchive path'
7373