summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2016-04-05 13:29:56 +0000
committerhallgren <hallgren@chalmers.se>2016-04-05 13:29:56 +0000
commitad22a4d899c7bbff81b437f9f603e88686657cbc (patch)
treef6591b8bf990dc447649d971bdb79782198e58ca
parent9db5139e23913803d44cbd51c55192cace91b384 (diff)
src/tools: update GFDoc.hs and Htmls.hs for compatibility with current libraries and add gf-tools.cabal to compile them
-rw-r--r--src/tools/GFDoc.hs19
-rw-r--r--src/tools/Htmls.hs4
-rw-r--r--src/tools/gf-tools.cabal12
3 files changed, 28 insertions, 7 deletions
diff --git a/src/tools/GFDoc.hs b/src/tools/GFDoc.hs
index fcd5ae405..dda9a316c 100644
--- a/src/tools/GFDoc.hs
+++ b/src/tools/GFDoc.hs
@@ -18,11 +18,12 @@ module Main (main) where
import Data.Char
import Data.List
-import System.Cmd
-import System.Directory
+import System.Process
+import System.Directory -- from package directory>=1.2
import System.Environment
-import System.Locale
-import System.Time
+import Data.Time -- from package time>=1.5
+--import System.Locale -- from package old-locale
+--import System.Time -- from package old-time
-- to read files and write a file
@@ -56,12 +57,20 @@ main = do
return ()
modTime :: FilePath -> IO ModTime
-modTime name =
+-- Works with directory>=1.2, time>=1.5
+modTime name =
+ do zt <- utcToLocalZonedTime =<< getModificationTime name
+ let timeFmt = "%Y-%m-%d %H:%M:%S %Z"
+ return $ formatTime defaultTimeLocale timeFmt zt
+{-
+-- Works with directory<1.2, old-time, old-locale
+modTime name =
do
t <- getModificationTime name
ct <- toCalendarTime t
let timeFmt = "%Y-%m-%d %H:%M:%S %Z"
return $ formatCalendarTime defaultTimeLocale timeFmt ct
+-}
welcome = unlines [
"",
diff --git a/src/tools/Htmls.hs b/src/tools/Htmls.hs
index ce0b3bb28..e4b7d4ccd 100644
--- a/src/tools/Htmls.hs
+++ b/src/tools/Htmls.hs
@@ -18,8 +18,8 @@
module Main (main) where
-import System
-import Char
+import System.Environment(getArgs)
+import Data.Char
main :: IO ()
main = do
diff --git a/src/tools/gf-tools.cabal b/src/tools/gf-tools.cabal
new file mode 100644
index 000000000..4222ae372
--- /dev/null
+++ b/src/tools/gf-tools.cabal
@@ -0,0 +1,12 @@
+name: gf-tools
+version: 0.1
+build-type: Simple
+cabal-version: >= 1.8
+
+Executable gfdoc
+ main-is: GFDoc.hs
+ build-depends: base, directory>=1.2, time>=1.5, process
+
+Executable htmls
+ main-is: Htmls.hs
+ build-depends: base