src/tools: update GFDoc.hs and Htmls.hs for compatibility with current libraries and add gf-tools.cabal to compile them

This commit is contained in:
hallgren
2016-04-05 13:29:56 +00:00
parent 9db5139e23
commit ad22a4d899
3 changed files with 28 additions and 7 deletions

View File

@@ -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 [
"",

View File

@@ -18,8 +18,8 @@
module Main (main) where
import System
import Char
import System.Environment(getArgs)
import Data.Char
main :: IO ()
main = do

12
src/tools/gf-tools.cabal Normal file
View File

@@ -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