Resolve paths when using XDG dirs, fixes #311
This commit is contained in:
parent
51690d1df3
commit
e40777a5d3
@ -137,7 +137,9 @@ ghcLinkDestination :: ( MonadReader env m
|
|||||||
ghcLinkDestination tool ver = do
|
ghcLinkDestination tool ver = do
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
ghcd <- ghcupGHCDir ver
|
ghcd <- ghcupGHCDir ver
|
||||||
pure (relativeSymlink binDir (ghcd </> "bin" </> tool))
|
ghcd' <- liftIO $ canonicalizePath ghcd
|
||||||
|
binDir' <- liftIO $ canonicalizePath binDir
|
||||||
|
pure (relativeSymlink binDir' (ghcd' </> "bin" </> tool))
|
||||||
|
|
||||||
|
|
||||||
-- | The symlink destination of a hls binary.
|
-- | The symlink destination of a hls binary.
|
||||||
@ -152,7 +154,9 @@ hlsLinkDestination :: ( MonadReader env m
|
|||||||
hlsLinkDestination tool ver = do
|
hlsLinkDestination tool ver = do
|
||||||
Dirs {..} <- getDirs
|
Dirs {..} <- getDirs
|
||||||
hlsd <- ghcupHLSDir ver
|
hlsd <- ghcupHLSDir ver
|
||||||
pure (relativeSymlink binDir (hlsd </> "bin" </> tool))
|
hlsd' <- liftIO $ canonicalizePath hlsd
|
||||||
|
binDir' <- liftIO $ canonicalizePath binDir
|
||||||
|
pure (relativeSymlink binDir' (hlsd' </> "bin" </> tool))
|
||||||
|
|
||||||
|
|
||||||
-- | Removes the minor GHC symlinks, e.g. ghc-8.6.5.
|
-- | Removes the minor GHC symlinks, e.g. ghc-8.6.5.
|
||||||
|
@ -335,6 +335,7 @@ useXDG :: IO Bool
|
|||||||
useXDG = isJust <$> lookupEnv "GHCUP_USE_XDG_DIRS"
|
useXDG = isJust <$> lookupEnv "GHCUP_USE_XDG_DIRS"
|
||||||
|
|
||||||
|
|
||||||
|
-- | Like 'relpath'. Assumes the inputs are resolved in case of symlinks.
|
||||||
relativeSymlink :: FilePath -- ^ the path in which to create the symlink
|
relativeSymlink :: FilePath -- ^ the path in which to create the symlink
|
||||||
-> FilePath -- ^ the symlink destination
|
-> FilePath -- ^ the symlink destination
|
||||||
-> FilePath
|
-> FilePath
|
||||||
|
Loading…
Reference in New Issue
Block a user