Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Added a better pause
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanuk12 committed Aug 21, 2022
1 parent c0803ec commit 09117ff
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
// Dependencies
use std::{fs, io::{stdin, stdout, Write}};
use std::{fs, io::{stdin, stdout, Write, Read}};
use platform_dirs::AppDirs;

// Pauses the application until userinput
fn pause() {
let mut stdin = stdin();
let mut stdout = stdout();

// We want the cursor to stay at the end of the line, so we print without a newline and flush manually.
write!(stdout, "Press any key to continue...").unwrap();
stdout.flush().unwrap();

// Read a single byte and discard
let _ = stdin.read(&mut [0u8]).unwrap();
}

// Path to the installation root dir
fn patch(path: String) {
// Patching the background file
Expand Down Expand Up @@ -68,6 +81,6 @@ fn main() {

//
patch(input_dir.to_string());
println!("Patched! Press enter to exit.");
stdin();
println!("Patched!");
pause();
}

0 comments on commit 09117ff

Please sign in to comment.