on master help sign in
Permit use of spaces in paths when entered from REPL and as args

Fixes #1320 :l and :lto doesn't like paths with spaces

commit67a9d66f12f5329c614991c5a0f7476301644f3a authorNiklas Larsson <niklas@mm.st> dateSat 25 Apr 2015, 16:07 (11 years ago) parent2a4b4a7
1 file changed+11−1
src/Idris/Chaser.hs+11−1
src/Idris/Chaser.hs+11−1
@@ -65,6 +65,16 @@ getModuleFiles ts = nub $ execState (modList ts) [] where
6565 then getSrc x : updateToSrc path xs
6666 else x : updateToSrc path xs
6767
68+-- Strip quotes and the backslash escapes that Haskeline adds
69+extractFileName :: String -> String
70+extractFileName ('"':xs) = takeWhile (/= '"') xs
71+extractFileName ('\'':xs) = takeWhile (/= '\'') xs
72+extractFileName x = build x []
73+ where
74+ build [] acc = reverse acc
75+ build ('\\':' ':xs) acc = build xs (' ':acc)
76+ build (x:xs) acc = build xs (x:acc)
77+
6878getIModTime (IBC i _) = getModificationTime i
6979getIModTime (IDR i) = getModificationTime i
7080getIModTime (LIDR i) = getModificationTime i
@@ -79,7 +89,7 @@ buildTree built fp = btree [] fp
7989 where
8090 btree done f =
8191 do i <- getIState
82− let file = takeWhile (/= ' ') f
92+ let file = extractFileName f
8393 iLOG $ "CHASING " ++ show file
8494 ibcsd <- valIBCSubDir i
8595 ids <- allImportDirs