Skip to content

Commit bf8d927

Browse files
authored
Merge pull request #123 from kisom/master
Be nicer when rustlings isn't run from the right directory.
2 parents 63280ed + 9fc4a83 commit bf8d927

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use notify::DebouncedEvent;
55
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
66
use std::ffi::OsStr;
77
use std::io::BufRead;
8+
use std::path::Path;
89
use std::sync::mpsc::channel;
910
use std::time::Duration;
1011
use syntect::easy::HighlightFile;
@@ -47,6 +48,14 @@ fn main() {
4748
println!();
4849
}
4950

51+
if !Path::new("info.toml").exists() {
52+
println!(
53+
"{} must be run from the rustlings directory",
54+
std::env::current_exe().unwrap().to_str().unwrap()
55+
);
56+
std::process::exit(1);
57+
}
58+
5059
if let Some(matches) = matches.subcommand_matches("run") {
5160
run(matches.clone()).unwrap();
5261
}

0 commit comments

Comments
 (0)