Skip to content

Commit

Permalink
Changed OS-based Line Ending Trimming
Browse files Browse the repository at this point in the history
- Changed the OS-based line ending trimming, and used just trim()
  • Loading branch information
CatRass committed Oct 31, 2024
1 parent 17f934b commit 8123d8d
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ fn main() {
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 saveLoc = saveLocInput.trim();

let saveFile = Save::load(saveLoc).unwrap();
saveFile.print();
Expand Down

0 comments on commit 8123d8d

Please sign in to comment.