Adjusted filepath for messaging
This commit is contained in:
parent
8a81ac1e54
commit
71ae985b68
3
oberon
3
oberon
|
@ -14,6 +14,7 @@ version = '0.8.1'
|
||||||
home_folder = os.path.expanduser('~')
|
home_folder = os.path.expanduser('~')
|
||||||
username = os.path.split(home_folder)[-1]
|
username = os.path.split(home_folder)[-1]
|
||||||
database = '/var/lib/oberon/oberon.sqlite'
|
database = '/var/lib/oberon/oberon.sqlite'
|
||||||
|
basefile = '/var/lib/oberon/'
|
||||||
|
|
||||||
|
|
||||||
def print_header():
|
def print_header():
|
||||||
|
@ -97,7 +98,7 @@ def play_game(gid):
|
||||||
res2 = db_do(q2, v2, True)
|
res2 = db_do(q2, v2, True)
|
||||||
if play['winner']:
|
if play['winner']:
|
||||||
enemy = state['p1'] if state['p1'] != username else state['p2']
|
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'
|
writemode = 'a' if fileexists(msg_path) else 'w'
|
||||||
with open(msg_path, writemode) as f:
|
with open(msg_path, writemode) as f:
|
||||||
f.write('{} defeated you in {} game {}\n'.format(username, state['game_type'], gid))
|
f.write('{} defeated you in {} game {}\n'.format(username, state['game_type'], gid))
|
||||||
|
|
Loading…
Reference in New Issue