Skip to content

Commit

Permalink
Inital
Browse files Browse the repository at this point in the history
  • Loading branch information
RealMrCactus committed Jun 19, 2024
1 parent 336eb93 commit c887ea8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "BVMR"
version = "0.1.0"
edition = "2021"

[dependencies]
35 changes: 35 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
fn replace(file_str: String) -> String {
let mut new_str = String::new();

// look for any reference of "JwIT" and replace it with "NwIT"
for line in file_str.lines() {
new_str.push_str(line.replace("JwIT", "NwIT").as_str());
}

new_str
}

fn main() {
// read the file from command flag
let args: Vec<String> = std::env::args().collect();

if args.is_empty() {
println!("Please drag vars onto executable.");
return;
}

let file_path = &args[1];
let file_str = std::fs::read_to_string(file_path).expect("Error reading file");

// replace the string
let new_str = replace(file_str);

// replace the file
std::fs::write(file_path, new_str).expect("Error writing file");

println!("Done!\nRemove the file named \"LiveDictionary\" manually.");

// wait for keypress of any
println!("Press any key to exit.");
std::io::stdin().read_line(&mut String::new()).unwrap();
}

0 comments on commit c887ea8

Please sign in to comment.