Skip to content

Commit

Permalink
Normalise, too, when making absolute paths.
Browse files Browse the repository at this point in the history
Otherwise, we might end up with things like `/foo/./bar`.
  • Loading branch information
nominolo committed Mar 13, 2009
1 parent f652e87 commit 3272e50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Scion/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ loadComponent comp = do
modifySessionState $ \s -> s { lastCompResult = rslt }
return rslt
where
maybe_set_working_dir (File f) =
let dir = dropFileName f in
maybe_set_working_dir (File f) = do
wd <- liftIO $ getCurrentDirectory
let dir = normalise $ wd </> dropFileName f
setWorkingDir dir
maybe_set_working_dir _ = do
dir <- cabalProjectRoot
Expand Down
2 changes: 1 addition & 1 deletion src/Scion/Types/Notes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mkAbsFilePath :: FilePath -- ^ base directory (must be absolute)
-> FilePath -- ^ absolute or relative
-> AbsFilePath
mkAbsFilePath baseDir dir
| isAbsolute baseDir = AFP $ baseDir </> dir
| isAbsolute baseDir = AFP $ normalise $ baseDir </> dir
| otherwise =
error "mkAbsFilePath: first argument must be an absolute path"

Expand Down

0 comments on commit 3272e50

Please sign in to comment.