Make saves configurable for the client #384
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having the ability to choose which save file is active would allow me to swap between them when, for instance, trying out different chunk sizes or switching between an older and newer version of Hypermine. It would also make it easier to test save files on an HDD to make sure that doesn't become an important bottleneck.
Fortunately, it looks like the implementation for this is quite simple. I chose to call the configuration option
save
for consistency with the server. If you give it a full path, it will save at that path, but if you give it a partial path, it will save in the data directory. All of this functionality comes for free with thePathBuf::join
function.