Created
August 19, 2018 00:33
-
-
Save Kampfkarren/1791b0c7ad680bf553e33c8397c602b4 to your computer and use it in GitHub Desktop.
A tool used to rename all RbxSync-formatted names to Rojo-formatted names
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
extern crate walkdir; | |
use std::env; | |
use std::fs; | |
use std::path::Path; | |
use walkdir::WalkDir; | |
fn main() -> std::io::Result<()> { | |
println!("RbxSync -> Rojo name format"); | |
let args:Vec<String> = env::args().collect(); | |
let game_path = &args[1]; | |
println!("Game path: {}", game_path); | |
for entry in WalkDir::new(game_path).into_iter().filter_map(|e| e.ok()) { | |
if !entry.path().is_file() { continue; } | |
let stem = Path::new(entry.path().file_stem().unwrap()); | |
let extension = match stem.extension() { | |
Some(ext) => if ext == "module" { "lua" } else { "local.lua" }, | |
None => "server.lua" | |
}; | |
let new_path = entry.path().with_file_name(format!("{}.{}", stem.file_stem().unwrap().to_str().unwrap(), extension)); | |
println!("{} -> {}", entry.path().display(), new_path.display()); | |
fs::rename(entry.path(), new_path)?; | |
} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment