From 37693ec0d73fca20427e4b009af82c8bf1bb7353 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Jun 2024 19:34:45 -0400 Subject: [PATCH] Modify -logFilePath to compute path every time If IRCChannel doesn't yet have an instance of TLOFileLogger to retrieve the value of writePath from, it will compute the path dynamically. But if there is an instance of TLOFileLogger, it will ask for writePath. But writePath is only valid when the file handle is open. The file handle is closed automatically if logging becomes idle. You don't want to have ton of file handles open if you aren't using them. So you then have edge case where user goes to open a previously active channel and there is no file path returned from TLOFileLogger because it's idle closed. --- Sources/App/Classes/IRC/IRCChannel.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Sources/App/Classes/IRC/IRCChannel.m b/Sources/App/Classes/IRC/IRCChannel.m index 8abf7dd37..ce0227684 100644 --- a/Sources/App/Classes/IRC/IRCChannel.m +++ b/Sources/App/Classes/IRC/IRCChannel.m @@ -247,13 +247,7 @@ DESIGNATED_INITIALIZER_EXCEPTION_BODY_END - (nullable NSURL *)logFilePath { - NSString *writePath = nil; - - if (self.logFile == nil) { - writePath = [TLOFileLogger writePathForItem:self]; - } else { - writePath = self.logFile.writePath; - } + NSString *writePath = [TLOFileLogger writePathForItem:self]; if (writePath == nil) { return nil;