From 85b05efcbb44bb1db6be941dbe7a61b36259628a Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 17 Mar 2022 22:51:17 +0100 Subject: [PATCH] Fix max path issues on windows with 'ghcup run' --- lib/GHCup/Utils/Dirs.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/GHCup/Utils/Dirs.hs b/lib/GHCup/Utils/Dirs.hs index 15e6fcb..b2fb7eb 100644 --- a/lib/GHCup/Utils/Dirs.hs +++ b/lib/GHCup/Utils/Dirs.hs @@ -339,13 +339,15 @@ useXDG = isJust <$> lookupEnv "GHCUP_USE_XDG_DIRS" relativeSymlink :: FilePath -- ^ the path in which to create the symlink -> FilePath -- ^ the symlink destination -> FilePath -relativeSymlink p1 p2 = - let d1 = splitDirectories p1 - d2 = splitDirectories p2 - common = takeWhile (\(x, y) -> x == y) $ zip d1 d2 - cPrefix = drop (length common) d1 - in joinPath (replicate (length cPrefix) "..") - <> joinPath ([pathSeparator] : drop (length common) d2) +relativeSymlink p1 p2 + | isWindows = p2 -- windows quickly gets into MAX_PATH issues so we don't care about relative symlinks + | otherwise = + let d1 = splitDirectories p1 + d2 = splitDirectories p2 + common = takeWhile (\(x, y) -> x == y) $ zip d1 d2 + cPrefix = drop (length common) d1 + in joinPath (replicate (length cPrefix) "..") + <> joinPath ([pathSeparator] : drop (length common) d2) cleanupTrash :: ( MonadIO m