From 70c7246b8c35823cf11e7a51bb99e1855090eb04 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 10 Jun 2017 05:35:33 +0300 Subject: addpath: refactoring --- app/AddPath.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/AddPath.hs b/app/AddPath.hs index df53326..fc8d5de 100644 --- a/app/AddPath.hs +++ b/app/AddPath.hs @@ -62,7 +62,7 @@ addPath :: Options -> IO () addPath options = runExceptT doAddPath >>= either ioError return where varName = optName options - pathsToAdd = nub $ optPaths options + pathsToAdd = optPaths options forAllUsers = optGlobal options profile @@ -83,7 +83,7 @@ addPath options = runExceptT doAddPath >>= either ioError return doAddPath = do oldValue <- WindowsEnv.query profile varName `catchE` emptyIfMissing let oldPaths = WindowsEnv.pathSplit oldValue - let newPaths = pathsToAdd \\ oldPaths + let newPaths = (nub pathsToAdd) \\ oldPaths unless (null newPaths) $ do let newValue = WindowsEnv.pathJoin $ append oldPaths newPaths let promptAnd = if skipPrompt -- cgit v1.2.3