Adjusted filepath for messaging

This commit is contained in:
sloumdrone 2019-04-29 23:03:12 -07:00
parent 8a81ac1e54
commit 71ae985b68
1 changed files with 2 additions and 1 deletions

3
oberon
View File

@ -14,6 +14,7 @@ version = '0.8.1'
home_folder = os.path.expanduser('~')
username = os.path.split(home_folder)[-1]
database = '/var/lib/oberon/oberon.sqlite'
basefile = '/var/lib/oberon/'
def print_header():
@ -97,7 +98,7 @@ def play_game(gid):
res2 = db_do(q2, v2, True)
if play['winner']:
enemy = state['p1'] if state['p1'] != username else state['p2']
msg_path = '/home/{}/.oberon'.format(enemy)
msg_path = basefile + '{}'.format(enemy)
writemode = 'a' if fileexists(msg_path) else 'w'
with open(msg_path, writemode) as f:
f.write('{} defeated you in {} game {}\n'.format(username, state['game_type'], gid))