diff options
-rw-r--r-- | app/AddPath.hs | 3 | ||||
-rw-r--r-- | app/RemovePath.hs | 2 | ||||
-rw-r--r-- | src/WindowsEnv/Environment.hs | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/app/AddPath.hs b/app/AddPath.hs index 209e28c..27ec0ed 100644 --- a/app/AddPath.hs +++ b/app/AddPath.hs @@ -91,8 +91,7 @@ addPath options = runExceptT doAddPath >>= either ioError return let destPaths = appendPaths srcPaths $ filter (`notElem` srcPaths) newPaths let destPathsJoined = WindowsEnv.pathJoin $ map pathOriginal destPaths let destValue = WindowsEnv.Value destExpandable destPathsJoined - when (srcValue /= destValue) $ do - promptAndEngrave srcValue destValue + when (srcValue /= destValue) $ promptAndEngrave srcValue destValue promptAndEngrave oldValue newValue = do let promptAnd = if skipPrompt diff --git a/app/RemovePath.hs b/app/RemovePath.hs index 56ea66f..779de6f 100644 --- a/app/RemovePath.hs +++ b/app/RemovePath.hs @@ -74,7 +74,7 @@ removePath options = runExceptT doRemovePath >>= either ioError return let expandable = WindowsEnv.valueExpandable oldValue let joined = WindowsEnv.valueString oldValue let split = WindowsEnv.pathSplit joined - let remaining = filter (flip notElem pathsToRemove) split + let remaining = filter (`notElem` pathsToRemove) split when (length split /= length remaining) $ do let newValue = WindowsEnv.Value expandable (WindowsEnv.pathJoin remaining) promptAndEngrave profile oldValue newValue diff --git a/src/WindowsEnv/Environment.hs b/src/WindowsEnv/Environment.hs index 258a1ae..aa05017 100644 --- a/src/WindowsEnv/Environment.hs +++ b/src/WindowsEnv/Environment.hs @@ -113,7 +113,7 @@ expand value = ExceptT $ catchIOError (Right <$> doExpand) (return . Left) doExpandIn valuePtr bufferPtr bufferLength = do newBufferLength <- WinAPI.failIfZero "ExpandEnvironmentStringsW" $ c_ExpandEnvironmentStrings valuePtr bufferPtr bufferLength - let newBufferSize = (fromIntegral newBufferLength) * sizeOf (undefined :: WinAPI.TCHAR) + let newBufferSize = fromIntegral newBufferLength * sizeOf (undefined :: WinAPI.TCHAR) if newBufferLength > bufferLength then allocaBytes newBufferSize $ \newBufferPtr -> doExpandIn valuePtr newBufferPtr newBufferLength else WinAPI.peekTString bufferPtr |