diff options
Diffstat (limited to '')
-rw-r--r-- | apps/FixNtSymbolPath.hs | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/apps/FixNtSymbolPath.hs b/apps/FixNtSymbolPath.hs index 9a02cf9..c75291e 100644 --- a/apps/FixNtSymbolPath.hs +++ b/apps/FixNtSymbolPath.hs @@ -4,46 +4,44 @@ - See LICENSE.txt for details. -} -module Main ( main ) where +module Main (main) where -import Control.Monad ( unless ) -import System.Directory ( createDirectoryIfMissing, getCurrentDirectory ) -import System.FilePath ( combine ) +import Control.Monad (unless) +import System.Directory (createDirectoryIfMissing, getCurrentDirectory) +import System.FilePath (combine) import qualified Environment getRemoteSymbolsDirectoryPath :: IO String getRemoteSymbolsDirectoryPath = do - localPath <- getLocalPath - createDirectoryIfMissing True localPath - return $ "SRV*" ++ localPath ++ "*" ++ remotePath - where - getLocalPath :: IO String - getLocalPath = do + localPath <- getLocalPath + createDirectoryIfMissing True localPath + return $ "SRV*" ++ localPath ++ "*" ++ remotePath + where + getLocalPath = do cwd <- getCurrentDirectory return $ combine cwd "symbols" - remotePath :: String - remotePath = "http://msdl.microsoft.com/download/symbols" + remotePath = "http://msdl.microsoft.com/download/symbols" getPdbsDirectoryPath :: IO String getPdbsDirectoryPath = do - cwd <- getCurrentDirectory - let path = combine cwd "pdbs" - createDirectoryIfMissing True path - return path + cwd <- getCurrentDirectory + let path = combine cwd "pdbs" + createDirectoryIfMissing True path + return path fixNtSymbolPath :: IO () fixNtSymbolPath = do - 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 = Environment.joinPaths $ presentPaths ++ missingPaths - Environment.saveToRegistry env ntSymbolPath newval + 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 = Environment.joinPaths $ presentPaths ++ missingPaths + Environment.saveToRegistry env ntSymbolPath newval where ntSymbolPath = "_NT_SYMBOL_PATH" |