done init

This commit is contained in:
grimhilt 2023-05-31 23:20:56 +02:00
parent 9341a6db7b
commit 709f0f3b84
2 changed files with 15 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ target
*.test *.test
.env .env
todo todo
.nextsync
.nextsyncignore

View File

@ -1,9 +1,20 @@
use std::fs::DirBuilder; use std::fs::{DirBuilder, File};
use std::env;
pub fn init() { pub fn init() {
let builder = DirBuilder::new(); let builder = DirBuilder::new();
match builder.create("./test/dir") { let mut path = env::current_dir().unwrap();
path.push(".nextsync");
match builder.create(path.clone()) {
Ok(()) => println!("Directory successfuly created"), Ok(()) => println!("Directory successfuly created"),
Err(_) => println!("Error: cannot create directory"), Err(_) => println!("Error: cannot create directory"),
} }
path.pop();
path.push(".nextsyncignore");
match File::create(path) {
Ok(_) => println!("File successfuly created"),
Err(_) => println!("Error: cannot create .nextsyncignore"),
}
} }