Replace assert with user-friendly error if ISO is invalid or not found (#1540)

* Replace assert with user-friendly error if ISO not found

When the extractor runs and can't detect a game folder, it will assume there is an ISO file in the directory instead. If there isn't an ISO file, or it's a different extension, it will trigger an assert. This adds an additional check to make sure the file extension is of type `.iso` and returns a more clear message to the user.

Once I get home I'll iterate upon this a bit to add file size checks and reading header data as well as making sure the error code is able to be reported to the launcher.

* Fix `extension` call & formatting

more de-rust lol

* fix extension call (again)

* fix ONE extra parenthesis

* argument incompatible with fmt print

will fix print later

* add ONE missing parenthesis 

never taking intellisense for granted again

* Add ISO size checks and rework type check

* actually print `data_dir_path` :p

* Normalize extension case before verifying file type

+ clang-format

* clang-format

Co-authored-by: doctashay <doctashay@github.com>
This commit is contained in:
Shalen Bennett
2022-06-24 16:27:57 -06:00
committed by GitHub
parent 67c815bf18
commit 20304715af
2 changed files with 32 additions and 3 deletions
@@ -20,4 +20,10 @@
"4030": {
"msg": "Decompilation Failed: An error occurred"
}
"4040": {
"msg": "Extraction Failed: Provided game data file was not an ISO file"
}
"4041": {
"msg": "Extraction Failed: Provided game data file was corrupt or has unexpected size"
}
}