diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-11 19:11:23 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-11 19:11:23 +0300 |
commit | 7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6 (patch) | |
tree | 8195393c18d0cdd3d9ebcdadb014d75285bfaf7e /apps | |
parent | become a proper stack project (diff) | |
download | windows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.tar.gz windows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.zip |
rename modules + fix compiler warnings
Diffstat (limited to 'apps')
-rw-r--r-- | apps/AddPath.hs | 16 | ||||
-rw-r--r-- | apps/FixNtSymbolPath.hs | 12 | ||||
-rw-r--r-- | apps/ListPath.hs | 6 | ||||
-rw-r--r-- | apps/RemovePath.hs | 14 | ||||
-rw-r--r-- | apps/SetEnv.hs | 10 | ||||
-rw-r--r-- | apps/UnsetEnv.hs | 10 |
6 files changed, 34 insertions, 34 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs index e17adc9..558c23c 100644 --- a/apps/AddPath.hs +++ b/apps/AddPath.hs @@ -12,7 +12,7 @@ import System.Environment ( getArgs, getProgName ) import System.Exit ( exitFailure, exitSuccess ) import System.IO ( hPutStr, stderr ) -import qualified EnvUtils +import qualified Environment main :: IO () main = do @@ -27,20 +27,20 @@ addPath :: [String] -> Options -> IO () addPath paths options = do missingPaths <- dropIncludedPaths paths when (not $ null missingPaths) $ do - oldPath <- EnvUtils.queryFromRegistry (env options) (name options) - EnvUtils.saveToRegistryWithPrompt (env options) (name options) $ EnvUtils.joinPaths $ missingPaths ++ [oldPath] + oldPath <- Environment.queryFromRegistry (env options) (name options) + Environment.saveToRegistryWithPrompt (env options) (name options) $ Environment.joinPaths $ missingPaths ++ [oldPath] where dropIncludedPaths paths = do - currentPath <- EnvUtils.getEnv $ name options - return $ filter (flip notElem $ EnvUtils.splitPaths currentPath) paths + currentPath <- Environment.getEnv $ name options + return $ filter (flip notElem $ Environment.splitPaths currentPath) paths data Options = Options { name :: String - , env :: EnvUtils.RegistryBasedEnvironment } + , env :: Environment.RegistryBasedEnvironment } deriving (Eq, Show) defaultOptions :: Options defaultOptions = Options { name = "PATH" - , env = EnvUtils.CurrentUserEnvironment } + , env = Environment.CurrentUserEnvironment } buildHelpMessage :: IO String buildHelpMessage = do @@ -71,6 +71,6 @@ invalidNumberOfArguments = exitWithUsageErrors ["invalid number of arguments\n"] optionDescription :: [OptDescr (Options -> IO Options)] optionDescription = [ Option "n" ["name"] (ReqArg (\s opts -> return opts { name = s }) "NAME") "set the variable name ('PATH' by default)", - Option "g" ["global"] (NoArg $ \opts -> return opts { env = EnvUtils.AllUsersEnvironment }) "add the path for all users", + Option "g" ["global"] (NoArg $ \opts -> return opts { env = Environment.AllUsersEnvironment }) "add the path for all users", Option "h" ["help"] (NoArg exitWithHelpMessage) "show this message and exit" ] diff --git a/apps/FixNtSymbolPath.hs b/apps/FixNtSymbolPath.hs index 404dc77..9a02cf9 100644 --- a/apps/FixNtSymbolPath.hs +++ b/apps/FixNtSymbolPath.hs @@ -10,7 +10,7 @@ import Control.Monad ( unless ) import System.Directory ( createDirectoryIfMissing, getCurrentDirectory ) import System.FilePath ( combine ) -import qualified EnvUtils +import qualified Environment getRemoteSymbolsDirectoryPath :: IO String getRemoteSymbolsDirectoryPath = do @@ -34,16 +34,16 @@ getPdbsDirectoryPath = do fixNtSymbolPath :: IO () fixNtSymbolPath = do - let env = EnvUtils.CurrentUserEnvironment - val <- EnvUtils.queryFromRegistry env ntSymbolPath - let presentPaths = EnvUtils.splitPaths val + let env = Environment.CurrentUserEnvironment + val <- Environment.queryFromRegistry env ntSymbolPath + let presentPaths = Environment.splitPaths val remoteSymbolsPath <- getRemoteSymbolsDirectoryPath pdbsPath <- getPdbsDirectoryPath let requiredPaths = [pdbsPath, remoteSymbolsPath] let missingPaths = filter (`notElem` presentPaths) requiredPaths unless (null missingPaths) $ do - let newval = EnvUtils.joinPaths $ presentPaths ++ missingPaths - EnvUtils.saveToRegistry env ntSymbolPath newval + let newval = Environment.joinPaths $ presentPaths ++ missingPaths + Environment.saveToRegistry env ntSymbolPath newval where ntSymbolPath = "_NT_SYMBOL_PATH" diff --git a/apps/ListPath.hs b/apps/ListPath.hs index ca72e87..75f1b27 100644 --- a/apps/ListPath.hs +++ b/apps/ListPath.hs @@ -12,7 +12,7 @@ import System.Environment ( getArgs, getProgName ) import System.Exit ( exitFailure, exitSuccess ) import System.IO ( hPutStr, stderr ) -import qualified EnvUtils +import qualified Environment main :: IO () main = do @@ -27,8 +27,8 @@ main = do listPath :: Options -> IO () listPath options = do - val <- EnvUtils.getEnv $ name options - mapM_ printPath $ EnvUtils.splitPaths val + val <- Environment.getEnv $ name options + mapM_ printPath $ Environment.splitPaths val where printPath p = do exists <- doesDirectoryExist p diff --git a/apps/RemovePath.hs b/apps/RemovePath.hs index 2e8fd01..3071708 100644 --- a/apps/RemovePath.hs +++ b/apps/RemovePath.hs @@ -12,7 +12,7 @@ import System.Environment ( getArgs, getProgName ) import System.Exit ( exitFailure, exitSuccess ) import System.IO ( hPutStr, stderr ) -import qualified EnvUtils +import qualified Environment main :: IO () main = do @@ -26,17 +26,17 @@ main = do removePath :: [String] -> Options -> IO () removePath paths options = do let varName = name options - userVal <- EnvUtils.queryFromRegistry EnvUtils.CurrentUserEnvironment varName - let userValParts = EnvUtils.splitPaths userVal + userVal <- Environment.queryFromRegistry Environment.CurrentUserEnvironment varName + let userValParts = Environment.splitPaths userVal let newUserValParts = filter (`notElem` paths) userValParts when (length userValParts /= length newUserValParts) $ do - EnvUtils.saveToRegistryWithPrompt EnvUtils.CurrentUserEnvironment varName $ EnvUtils.joinPaths newUserValParts + Environment.saveToRegistryWithPrompt Environment.CurrentUserEnvironment varName $ Environment.joinPaths newUserValParts when (global options) $ do - globalVal <- EnvUtils.queryFromRegistry EnvUtils.AllUsersEnvironment varName - let globalValParts = EnvUtils.splitPaths globalVal + globalVal <- Environment.queryFromRegistry Environment.AllUsersEnvironment varName + let globalValParts = Environment.splitPaths globalVal let newGlobalValParts = filter (`notElem` paths) globalValParts when (length globalValParts /= length newGlobalValParts) $ do - EnvUtils.saveToRegistryWithPrompt EnvUtils.AllUsersEnvironment varName $ EnvUtils.joinPaths newGlobalValParts + Environment.saveToRegistryWithPrompt Environment.AllUsersEnvironment varName $ Environment.joinPaths newGlobalValParts data Options = Options { name :: String , global :: Bool } diff --git a/apps/SetEnv.hs b/apps/SetEnv.hs index 30f5b1e..fda9726 100644 --- a/apps/SetEnv.hs +++ b/apps/SetEnv.hs @@ -11,7 +11,7 @@ import System.Environment ( getArgs, getProgName ) import System.Exit ( exitFailure, exitSuccess ) import System.IO ( hPutStr, stderr ) -import qualified EnvUtils +import qualified Environment main :: IO () main = do @@ -26,12 +26,12 @@ main = do exitWithUsageErrors errorMessages setEnv :: String -> String -> Options -> IO () -setEnv name value options = EnvUtils.saveToRegistryWithPrompt (env options) name value +setEnv name value options = Environment.saveToRegistryWithPrompt (env options) name value -data Options = Options { env :: EnvUtils.RegistryBasedEnvironment } deriving (Eq, Show) +data Options = Options { env :: Environment.RegistryBasedEnvironment } deriving (Eq, Show) defaultOptions :: Options -defaultOptions = Options { env = EnvUtils.CurrentUserEnvironment } +defaultOptions = Options { env = Environment.CurrentUserEnvironment } buildHelpMessage :: IO String buildHelpMessage = do @@ -61,6 +61,6 @@ invalidNumberOfArguments = exitWithUsageErrors ["invalid number of arguments\n"] optionDescription :: [OptDescr (Options -> IO Options)] optionDescription = [ - Option "g" ["global"] (NoArg $ \opts -> return opts { env = EnvUtils.AllUsersEnvironment }) "save under the registry key for all users", + Option "g" ["global"] (NoArg $ \opts -> return opts { env = Environment.AllUsersEnvironment }) "save under the registry key for all users", Option "h" ["help"] (NoArg exitWithHelpMessage) "show this message and exit" ] diff --git a/apps/UnsetEnv.hs b/apps/UnsetEnv.hs index cd43696..254f383 100644 --- a/apps/UnsetEnv.hs +++ b/apps/UnsetEnv.hs @@ -11,7 +11,7 @@ import System.Environment ( getArgs, getProgName ) import System.Exit ( exitFailure, exitSuccess ) import System.IO ( hPutStr, stderr ) -import qualified EnvUtils +import qualified Environment main :: IO () main = do @@ -25,12 +25,12 @@ main = do (_, _, errorMessages) -> exitWithUsageErrors errorMessages unsetEnv :: String -> Options -> IO () -unsetEnv name options = EnvUtils.wipeFromRegistryWithPrompt (env options) name +unsetEnv name options = Environment.wipeFromRegistryWithPrompt (env options) name -data Options = Options { env :: EnvUtils.RegistryBasedEnvironment } deriving (Eq, Show) +data Options = Options { env :: Environment.RegistryBasedEnvironment } deriving (Eq, Show) defaultOptions :: Options -defaultOptions = Options { env = EnvUtils.CurrentUserEnvironment } +defaultOptions = Options { env = Environment.CurrentUserEnvironment } buildHelpMessage :: IO String buildHelpMessage = do @@ -60,6 +60,6 @@ invalidNumberOfArguments = exitWithUsageErrors ["invalid number of arguments\n"] optionDescription :: [OptDescr (Options -> IO Options)] optionDescription = [ - Option "g" ["global"] (NoArg $ \opts -> return opts { env = EnvUtils.AllUsersEnvironment }) "delete from the registry key for all users", + Option "g" ["global"] (NoArg $ \opts -> return opts { env = Environment.AllUsersEnvironment }) "delete from the registry key for all users", Option "h" ["help"] (NoArg exitWithHelpMessage) "show this message and exit" ] |