Misc: Fix lastpath updating when using the --elf cmdline arg #4663
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.
Description of Changes
There was a chance that doing
--elf="P://dir1/dir2/elf.elf"
would save the last path asP://dir2/elf.elf
, completely voiding the functionality of #4444Also verify that an ELF file exists before trying to execute it.
Rationale behind Changes
#4444 was no longer working in certain scenarios
Currently, running an invalid ELF (one that doesn't exist for example) would put the emulator in a strange state with no immediate explanation for the user.
Suggested Testing Steps
Run ELF files from the command line and see if opening an elf file via gui brings you to the directory specified in the command line.
Try running non-existent ELF files and verify that PCSX2 no longer breaks.