Skip to content

Instantly share code, notes, and snippets.

@chasinglogic
Created June 7, 2016 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chasinglogic/ebe65b7f8bf9d21a7a83a5ebbfd59686 to your computer and use it in GitHub Desktop.
Save chasinglogic/ebe65b7f8bf9d21a7a83a5ebbfd59686 to your computer and use it in GitHub Desktop.
pub fn gen_module(mut name: String, private: bool) {
let mut working_dir = env::current_dir().expect("Unexpected Error: Cannot get current working directory.");
// This makes sure that the name ends with .rs if not a directory
if is_file(&name) { name.push_str(".rs") }
for dir in name.split("/") {
if is_file(&dir) {
working_dir.push(name);
gen_file_module(working_dir.clone());
break;
}
gen_folder_module(working_dir.clone());
update_modrs(working_dir, generate_modstring(dir, private));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment