diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index fa6de9c..af2744e 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -137,7 +137,9 @@ ghcLinkDestination :: ( MonadReader env m ghcLinkDestination tool ver = do Dirs {..} <- getDirs 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. @@ -152,7 +154,9 @@ hlsLinkDestination :: ( MonadReader env m hlsLinkDestination tool ver = do Dirs {..} <- getDirs 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. diff --git a/lib/GHCup/Utils/Dirs.hs b/lib/GHCup/Utils/Dirs.hs index c4749b8..15e6fcb 100644 --- a/lib/GHCup/Utils/Dirs.hs +++ b/lib/GHCup/Utils/Dirs.hs @@ -335,6 +335,7 @@ useXDG :: IO Bool 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 -> FilePath -- ^ the symlink destination -> FilePath