Skip to content

Commit

Permalink
Merge pull request #809 from lxkurko/0.59
Browse files Browse the repository at this point in the history
Dedicated fix - find writable path for log file
  • Loading branch information
karelp committed Mar 13, 2017
2 parents aefb5ad + 8a53ad2 commit 3825306
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions share/gamedir/cfg/dedicated_config.py
Expand Up @@ -8,6 +8,7 @@
SERVER_PORT = 23400 # What port to start server on, 23400 is the default

# Where to log what is happening
#NOTE: Do not specify path here, only file name. Path will be searched automatically based on Openlierox settings
LOG_FILE = "dedicated_control.log"

MIN_PLAYERS = 1
Expand Down
1 change: 1 addition & 0 deletions share/gamedir/cfg/dedicated_config_lx56.py
Expand Up @@ -8,6 +8,7 @@
SERVER_PORT = 23402 # What port to start server on, 23400 is the default

# Where to log what is happening
#NOTE: Do not specify path here, only file name. Path will be searched automatically based on Openlierox settings
LOG_FILE = "dedicated_control.log"

MIN_PLAYERS = 1
Expand Down
6 changes: 4 additions & 2 deletions share/gamedir/scripts/dedicated_control_io.py
Expand Up @@ -230,14 +230,16 @@ def messageLog(message,severity = LOG_INFO):

outline += " -- "
outline += str(message) #incase we get anything other than string

try:
f = open(cfg.LOG_FILE,"a")
log_filename = getWriteFullFileName(cfg.LOG_FILE)
f = open(log_filename,"a")
f.write((outline + "\n"))
f.close()
except IOError:
msg("ERROR: Unable to open logfile.")
except NameError: # can happen if cfg is not defined - we accept that
pass
msg("WARN: Name error when attempting to log - cfg probably not loaded yet")

#It's possible that we get a broken pipe here, but we can't exit clearly and also display it,
# so let python send out the ugly warning.
Expand Down

0 comments on commit 3825306

Please sign in to comment.