git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Process os stuff better.
commite3e80c135a8d9cc0f82daa6e060e03eb9bf835c9 authorjoneshf <jones3.hardy@gmail.com> dateThu 20 Feb 2014, 17:54 (13 years ago) parentf926a80
2 files changed+21−5
Setup.hs+18−4 purescript.cabal+3−1
Setup.hs+18−4
@@ -1,7 +1,17 @@
11{-# LANGUAGE CPP #-}
22
3+#ifndef POSIX_LIKE
4+#define POSIX_LIKE !defined(_WIN32_HOST_OS) && \
5+ (defined(unix_HOST_OS) || defined(__unix___HOST_OS) || \
6+ defined(__unix_HOST_OS) || defined(linux_HOST_OS) || \
7+ defined(__linux___HOST_OS) || defined(__linux_HOST_OS) || \
8+ (defined(__APPLE___HOST_OS) && defined(__MACH___HOST_OS)))
9+#endif
10+
311module Main where
412
13+import Control.Monad
14+
515import Distribution.PackageDescription
616import Distribution.Simple
717import Distribution.Simple.LocalBuildInfo
@@ -9,7 +19,7 @@ import Distribution.Simple.Setup
919
1020import System.Directory
1121import System.Environment.XDG.BaseDir
12−#if !defined(mingw32_HOST_OS) || !defined(__MINGW32__)
22+#if POSIX_LIKE
1323import System.Posix.Files
1424#endif
1525
@@ -19,7 +29,11 @@ main = defaultMainWithHooks $ simpleUserHooks {postInst = setupXDG}
1929setupXDG :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
2030setupXDG _ _ _ _ = do
2131 configDir <- getUserConfigDir "purescript"
22− createDirectoryIfMissing True configDir
23−#if !defined(mingw32_HOST_OS) || !defined(__MINGW32__)
24− setFileMode configDir ownerModes
32+ configExists <- doesDirectoryExist configDir
33+ putStrLn "\n\n\noh it worked!\n\n\n"
34+ unless configExists $ do
35+ createDirectoryIfMissing True configDir
36+#if POSIX_LIKE
37+ setFileMode configDir ownerModes
2538#endif
39+#undef POSIX_LIKE
purescript.cabal+3−1
@@ -20,7 +20,9 @@ library
2020 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
2121 directory -any, filepath -any, mtl -any, parsec -any, syb -any,
2222 transformers -any, utf8-string -any, pattern-arrows -any, monad-unify >= 0.2 && < 0.3,
23− xdg-basedir -any, unix -any
23+ xdg-basedir -any
24+ if (!os(windows))
25+ build-depends: unix -any
2426 exposed-modules: Data.Generics.Extras
2527 Language.PureScript
2628 Language.PureScript.Options