Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3966 closed defect (fixed)

[PATCH] Empty simlog directories

Reported by: elexis Owned by: elexis
Priority: Must Have Milestone: Alpha 21
Component: Core engine Keywords: patch
Cc: Patch:

Description

#3255 changed the directory structure of replays, simlogs and oosdumps and create a subdirectory with the current date in the name.

However it creates an empty directory for the oosdump even if there was no OOS (reported by Vladislav).

As mentioned by leper on 2016-03-14, the code should also create the sim-log directory if the user deletes the directory while the app is running that writes to that path.

Attachments (1)

t3966_no_empty_simlog_directories_v1.patch (5.3 KB ) - added by elexis 8 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 by elexis, 8 years ago

Cc: leper added
Keywords: patch review added
Summary: Empty simlog directories[PATCH] Empty simlog directories

The uploaded patch fixes the empty direcory bug reported by Vladislav by moving the createDir into the if-statement.

With regards to lepers codestyle objections about the two commits r17761 and r17776 of #3255 from 2016-03-14:

23:08 <@leper> r17761 why are there two debug_printfs for ooslogs?
23:09 <@leper> emphasis on multiple
23:19 < elexis> leper: ooslogs could also be inited in the ctor due to CFG_GET_VAL("ooslog", m_EnableOOSLog);
23:19 < elexis> EnableOOSLog() could early-return if it already is enabled
23:20 <@leper> ok

-> So that part of the code is still valid.

23:09 <@leper> also why not multiple folders (year/month/day)?
23:09 <@leper> but meh
23:10 < elexis> sorry, wasnt convinced of three layers, maybe YYYY-MM/DD_ID/ still, a full date might be more understandable

-> (Still true)

23:56 <@leper> elexis: r17776 comment for the default param, if(, having getSomethingString create directories is stupid, dumpstate doesn't create the dir anymore

->

  • Comment added, not sure if it's a good/descriptive or needed one. People could also read or try the code.
  • if( wasn't in the code that I added. The commit significantly changed the logic, so it shouldn't include whitespace changes in untouched lines, to keep the changeset as small and readable as possible.
  • Renamed getDateIndexSubdirectory to createDateIndexSubdirectory
  • In a later discussion on IRC which I can't find anymore, I argued that users who delete directories which running programs write data to should expect that the program doesn't like that. I added that CreateDirectories back and added also a LOGWARNING. If we have code to cover such an edge case, it should be treated correctly at least.

comment:2 by elexis, 8 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 18183:

Cleanup of #3255, fixes #3966.

Don't create an empty oos_logs directory when starting the game.
Rename getDateIndexSubdirectory to createDateIndexSubdirectory.
Add a comment for the breakpoint argument of CreateDirectories.

comment:3 by elexis, 8 years ago

Cc: leper removed
Keywords: review removed

Thanks leper for a quick review on irc.

Note: See TracTickets for help on using tickets.