-
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.
- Loading branch information
1 parent
336eb93
commit c887ea8
Showing
4 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "BVMR" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
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 |
---|---|---|
@@ -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(); | ||
} |