This fixes issue #25, which an acquaintance just ran into this weekend.
While the issue was technically caused by log files being stored in the the same folder as the app itself, it's really because getOldYSFReflectorLog was reading any and all entries (including directories) in the designated folder, rather than just log files (as well as by it using different logic to identify lines than getYSFReflectorLog` uses).
This update makes the following changes:
Check if the current file is both an actual file, and ends in .log (this could be improved further, using YSFREFLECTORLOGPREFIX and/or having listdir_by_date use glob to match only the desired files in the first place?).
Use the same startsWith test as getYSFReflectorLog uses to test if it's an applicable log line.
Counts up to SHOWOLDMHEARD rather than down from (nitpicking), and stops looping once that limit is reached. It also only counts log files it succesfully opened.
This ensures that, regardless of where logs are stored, getOldYSFReflectorLog will return expected data (unless of course some other log files exist that have lines starting with M:).
This is arguably a bit of excessive idiot-proofing, but given how much of a pain it is to track down the cause from a DateTime parse error, it's probably worth it.
This fixes issue #25, which an acquaintance just ran into this weekend.
While the issue was technically caused by log files being stored in the the same folder as the app itself, it's really because getOldYSFReflectorLog was reading any and all entries (including directories) in the designated folder, rather than just log files (as well as by it using different logic to identify lines than getYSFReflectorLog` uses).
This update makes the following changes:
This ensures that, regardless of where logs are stored, getOldYSFReflectorLog will return expected data (unless of course some other log files exist that have lines starting with M:).
This is arguably a bit of excessive idiot-proofing, but given how much of a pain it is to track down the cause from a DateTime parse error, it's probably worth it.