--- a/gameServer/ConfigFile.hs Tue Mar 08 21:27:44 2011 +0300
+++ b/gameServer/ConfigFile.hs Tue Mar 08 21:45:00 2011 +0300
@@ -7,8 +7,11 @@
-------------------
import CoreTypes
+cfgFileName :: String
cfgFileName = "hedgewars-server.ini"
+
+readServerConfig :: ServerInfo -> IO ServerInfo
readServerConfig serverInfo' = do
cfg <- readConfig cfgFileName
let si = serverInfo'{
@@ -28,6 +31,7 @@
fromJust2 _ (Just a) = a
+writeServerConfig :: ServerInfo -> IO ()
writeServerConfig ServerInfo{serverConfig = Nothing} = return ()
writeServerConfig ServerInfo{
dbHost = dh,
@@ -40,7 +44,7 @@
serverConfig = Just cfg}
= do
let newCfg = foldl (\c (n, v) -> repConfig n (B.unpack v) c) cfg entries
- writeConfig cfgFileName (repConfig "sv_latestProto" (show ver) cfg)
+ writeConfig cfgFileName (repConfig "sv_latestProto" (show ver) newCfg)
where
entries = [
("dbHost", dh)