diff options
author | Eli Flanagan <eli@typedspace.com> | 2019-09-13 00:14:07 +0000 |
---|---|---|
committer | Eli Flanagan <eli@typedspace.com> | 2019-09-13 00:14:07 +0000 |
commit | cd03f984bacbcacc57d5ce07c13bc401b48c09f9 (patch) | |
tree | b7095498fa4cadc1a54ecbb736d0be40e6b5b785 | |
parent | change to path option for configurability (diff) | |
download | miniserve-cd03f984bacbcacc57d5ce07c13bc401b48c09f9.tar.gz miniserve-cd03f984bacbcacc57d5ce07c13bc401b48c09f9.zip |
warn user if provided index file is not found
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 5db9b31..d5055b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -122,6 +122,14 @@ fn run() -> Result<(), ContextualError> { let canon_path = miniserve_config.path.canonicalize().map_err(|e| { ContextualError::IOError("Failed to resolve path to be served".to_string(), e) })?; + + if let Some(index_path) = &miniserve_config.index { + let has_index: std::path::PathBuf = [&canon_path, index_path].iter().collect(); + if !has_index.exists() { + + println!("{warning} The provided index file could not be found.", warning=Color::RGB(255, 192, 0).paint("Notice:").bold()); + } + } let path_string = canon_path.to_string_lossy(); println!( |