1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-14 22:32:11 +03:00

Handle new Journal filename in Beta

This commit is contained in:
Jonathan Harris 2017-08-17 16:31:51 +01:00
parent a2ce9da44e
commit 9869cd58e8

View File

@ -164,7 +164,8 @@ class EDLogs(FileSystemEventHandler):
# Latest pre-existing logfile - e.g. if E:D is already running. Assumes logs sort alphabetically.
# Do this before setting up the observer in case the journal directory has gone away
try:
logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal.') and x.endswith('.log')])
logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal') and x.endswith('.log')],
key=lambda x: x.split('.')[1:])
self.logfile = logfiles and join(self.currentdir, logfiles[-1]) or None
except:
self.logfile = None
@ -224,7 +225,7 @@ class EDLogs(FileSystemEventHandler):
def on_created(self, event):
# watchdog callback, e.g. client (re)started.
if not event.is_directory and basename(event.src_path).startswith('Journal.') and basename(event.src_path).endswith('.log'):
if not event.is_directory and basename(event.src_path).startswith('Journal') and basename(event.src_path).endswith('.log'):
self.logfile = event.src_path
def worker(self):
@ -263,7 +264,8 @@ class EDLogs(FileSystemEventHandler):
else:
# Poll
try:
logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal.') and x.endswith('.log')])
logfiles = sorted([x for x in listdir(self.currentdir) if x.startswith('Journal') and x.endswith('.log')],
key=lambda x: x.split('.')[1:])
newlogfile = logfiles and join(self.currentdir, logfiles[-1]) or None
except:
if __debug__: print_exc()