module Main where
import IO
import System.Cmd
import System.Exit
import System.Directory
import System.Environment
main = do
createInstallPath "__CONFIG_PATH__"
args <- getArgs
let args' = filter (/= "--global") args
exitcode <- rawSystem "__GHC__" ("-package-conf":"__CONFIG_PATH__":args')
exitWith exitcode
createInstallPath path = do
config_exists <- doesFileExist path
if config_exists
then return ()
else bracket (openFile path WriteMode) hClose (\h -> do hPutStr h "[]")