aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-06-10 05:35:33 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-06-10 05:35:33 +0300
commit70c7246b8c35823cf11e7a51bb99e1855090eb04 (patch)
tree1f76559e3f5192ebdea81e666489b2a3b17f42a0
parentaddpath: add --prepend option (diff)
downloadwindows-env-70c7246b8c35823cf11e7a51bb99e1855090eb04.tar.gz
windows-env-70c7246b8c35823cf11e7a51bb99e1855090eb04.zip
addpath: refactoring
-rw-r--r--app/AddPath.hs4
1 files changed, 2 insertions, 2 deletions
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