Skip to content
Snippets Groups Projects
Commit 1dfe5cfe authored by Arjun Kathuria's avatar Arjun Kathuria :rocket:
Browse files

updates path equating (which may fail) in "rmGhcup" function.

parent 8e455065
No related branches found
No related tags found
1 merge request!101[WIP] Feature "nuke"
...@@ -1294,8 +1294,23 @@ rmGhcup = do ...@@ -1294,8 +1294,23 @@ rmGhcup = do
AppState {dirs = Dirs {binDir}} <- ask AppState {dirs = Dirs {binDir}} <- ask
let ghcupFilename = "ghcup" <> exeExt let ghcupFilename = "ghcup" <> exeExt
let ghcupFilepath = binDir </> ghcupFilename let ghcupFilepath = binDir </> ghcupFilename
currentRunningExecPath <- liftIO $ getExecutablePath currentRunningExecPath <- liftIO $ getExecutablePath
if currentRunningExecPath == ghcupFilepath
-- if paths do no exist, warn user, and continue to compare them, as is,
-- which should eventually fail and result in a non-standard install warning
p1 <- handleIO' doesNotExistErrorType
(handlePathNotPresent currentRunningExecPath)
(liftIO $ canonicalizePath currentRunningExecPath)
p2 <- handleIO' doesNotExistErrorType
(handlePathNotPresent ghcupFilename)
(liftIO $ canonicalizePath ghcupFilename)
let areEqualPaths = equalFilePath p1 p2
if areEqualPaths
then then
do do
#if defined(IS_WINDOWS) #if defined(IS_WINDOWS)
...@@ -1315,6 +1330,10 @@ rmGhcup = do ...@@ -1315,6 +1330,10 @@ rmGhcup = do
nonStandardInstallLocationMsg currentRunningExecPath nonStandardInstallLocationMsg currentRunningExecPath
where where
handlePathNotPresent fp _err = do
$logWarn $ "Error: The path does not exist, " <> T.pack fp
pure fp
nonStandardInstallLocationMsg path = T.pack $ nonStandardInstallLocationMsg path = T.pack $
"current ghcup is invoked from a non-standard location: \n" "current ghcup is invoked from a non-standard location: \n"
<> path <> <> path <>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment