-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Ability to Select Save From CLI
- Added input for user to select location of save file - Renamed unexpected file loading error from 'Error' to 'Unexpected Error'
- Loading branch information
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,28 @@ | ||
#![allow(non_snake_case)] | ||
|
||
pub mod PKRust; | ||
use std::io::{self, Write}; | ||
|
||
use PKRust::saveLoader::Save; | ||
|
||
fn main() { | ||
let saveFile = Save::load("./test/POKEMON YELLOW 2.sav").unwrap(); | ||
|
||
io::stdout().write_all(b"Please Select a Save File: ").unwrap(); | ||
io::stdout().flush().unwrap(); | ||
|
||
let mut saveLocInput = String::new(); | ||
io::stdin().read_line(&mut saveLocInput).expect("Error recieving User Input"); | ||
|
||
let mut saveLoc = ""; | ||
// The read_line collects line endings, so we need to remove them. | ||
// This varies across different OS' though, so I've split it | ||
// into Unix and Windows | ||
if cfg!(windows) { | ||
saveLoc = saveLocInput.strip_suffix("\r\n").unwrap(); | ||
} else if cfg!(unix) { | ||
saveLoc = saveLocInput.strip_suffix("\n").unwrap(); | ||
} | ||
|
||
let saveFile = Save::load(saveLoc).unwrap(); | ||
saveFile.print(); | ||
} |