add source.rs
This commit is contained in:
parent
c6603e3882
commit
d2a89c66ab
9
src/utils/source.rs
Normal file
9
src/utils/source.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
|
pub fn validate_source(source: &str) -> bool
|
||||||
|
{
|
||||||
|
let re = Regex::new(r"^https?://.*").unwrap();
|
||||||
|
return Path::new(&source).is_file() || re.is_match(&source);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user