set root dir with argument
This commit is contained in:
parent
864f94ba5d
commit
b27b952359
1 changed files with 7 additions and 1 deletions
|
@ -18,7 +18,13 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
&args[1]
|
&args[1]
|
||||||
};
|
};
|
||||||
println!("Starting server on {:?}...\n", &host);
|
println!("Starting server on {:?}", &host);
|
||||||
|
|
||||||
|
if args.len() > 2 {
|
||||||
|
env::set_current_dir(&args[2]).expect("root dir specified must be valid path");
|
||||||
|
println!("Set root dir to {}", &args[2]);
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
|
||||||
let listener = TcpListener::bind(host).expect("Could not bind to address");
|
let listener = TcpListener::bind(host).expect("Could not bind to address");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue