Refactor CARD FileIO with on-demand handles#77
Conversation
|
While I'm not opposed to this, I'm concerned that this could cause potential race conditions with the file system driver. Does SDL guarantee a flush when the stream is closed? Or does it defer that? To clarify, I'm not so much concerned that aurora will get invalid data, I'm concerned that the user might accidentally copy the raw file while the stream is mid-write and get an incomplete/outdated file. |
|
Added SDL_FlushIO to paths to the FileIO constructor and fileWrite(), it believe it would be unnecessary for fileRead but let me know what you think |
Yeah, it's unnecessary for read, flushing is only relevant for write. |
|
Would it not be better to just set |
|
I don't see why we need to maintain a handle to a file that's only going to be periodically read and written to begin with. |
|
I'm also just not sure how that'd be done with SDL. Isn't FILE_SHARE_WRITE a Win32 API specific thing? |
So that there is no potential for the write to fail due to another program having a handle open. |
It is, lets avoid non-portable code where possible, I'd rather not have ifdef'd per platform code where it's not needed, SDL is perfectly adequate for what we're doing. |
|
Refactors CARD FileIO to only have a handle open on the RAW save when actually in use.
Among other benefits, this prevents Windows (and presumably other OSes) from blocking you from making copies of the RAW save while a port utilizing Aurora is running, which can be irritating during development.