This repository has been archived by the owner on Jun 7, 2022. It is now read-only.
Cover scenarios when looking for resources folder #54
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.
Fixes #51
change_to_resources_parent_dir
that gets called near the top ofmain
resources
folder by all three methods laid out in Cover more scenarios when looking for resources folder #51resources
in the working directoryresources
in the parent directory of the binary (e.g.target/debug/gv_client
=>target/debug/resources
)$CARGO_MANIFEST_DIR/../..
, and checks forresources
in there ¹println!
messageErr(Error::new(ErrorKind::NotFound, "Could not find resources folder"))
main
calls the function with...?
, so the game now exits gracefully with an error message to stdio if resources are not found¹ Please verify that this is intended behavior. I have tested that it works as described above, but there may be a solution preferable to assuming that
$CARGO_MANIFEST_DIR
is two subdirectories down from root.I have tested each of the scenarios listed, as well as the expected failure case (no resources folder in any of the expected locations) on Windows. I recommend that reviewers test them as well, especially on Linux and perhaps on MacOS. That said, the code only depends on
std::path::PathBuf
, so it should work as described.