feat: read VPK files and version.txt migration support#60
feat: read VPK files and version.txt migration support#60sour-dani wants to merge 27 commits intoktwrd:developfrom
version.txt migration support#60Conversation
Add valve_pak crate for vpk support Uses a vpk.json (temp name) for general information (determining what needs to be translated and placed in the new .adastral file and if the vpk needs to be accessed)
Added a not installed check in get_current_version so that the installer doesn't try to generate a version for a non existing mod Panic on failing to create an .adastral version if not installed from installation Renamed vpk.json to data.json Add multiple utility functions for opening a version file and data.json file Added some comments More error handling added (there's a lot of panic! calls so it might not be the best way to handle it)
- Removed `open_json_file_content` function in place of Structs - Created new structs: `RemoteFileMapResponse`, `RemoteFiles`, and `RemoteVersionMap` - Create `get_file_map()` which remotely grabs `filemap.json` - Updated `reading_mod_version_file` to now use remote `filemap.json` - Updated `generate_version_file`, `read_mode_version_file`, `get_current_version` to `async` - Added `filemap_url` support to `appvar.rs`
- Update `read_mod_version_file` to take a `&RemoteFiles` parameter instead of calling the API.
Mainly with the sourcemods_location checks. Only panic if it fails to create an adastral version file since it's needed to determine versioning
|
Thanks for the PR @sour-dani and @rawra89 |
|
Should be able to look at this on the weekend, since I finally have some spare time 🎉 |
|
This is good enough, I'll fix the minor issues myself in the develop branch :3 |
There was a problem hiding this comment.
I'll fix the issues that I pointed out in the develop branch.
@sour-dani @rawra89 Please fix the merge conflicts so I can merge this.
| }, | ||
|
|
||
| #[error("Failed to find local version '{expected}' in remote filemap.")] | ||
| RemoteFileMapLocalVersionNotFound |
There was a problem hiding this comment.
Could the remote versions.json URL be included in this error?
| dark-light = "2.0.0" | ||
| image = { version = "0.25.8", features = ["png"] } | ||
| valve_pak = "0.1.0" | ||
| anyhow = "1.0.100" |
There was a problem hiding this comment.
Could you put a comment here saying that anyhow should never be used for returning errors, and that it should only be used as the "source" for an error
e.g:
#[error("Failed to read VPK file contents at {location}. ({error:})")]
VpkReadFailure
{
location: String,
error: anyhow::Error,
backtrace: Backtrace
}Even though it's in the CONTRIBUTING.md file, it's good to put it here anyways for future reference.
| pub versions_url: String, | ||
| /// optional: url where the file mapping details are stored for upgrading | ||
| /// game versions from previous systems. e.g; `https://beans.adastral.net/filemap.json` | ||
| pub filemap_url: String |
There was a problem hiding this comment.
Does the code support this being optional? filemap.json might not be used by all mods, and it would be good if this wasn't a requirement.
Preferably it would be good for it to be Option<String> so the appvar.json doesn't need to be modified if a mod doesn't use filemap.json (like Open Fortress).
|
Review is neither stale nor dismissed. I only fixed the merge conflict. |
version.txtversion numbers to.adastral.vpkfile along with how the versions should be translated.