Give error if data_dir exists but is a file.
This commit is contained in:
parent
e62722e397
commit
2149821ebd
@ -78,7 +78,12 @@ fn main()
|
|||||||
Err(_e) => PathBuf::from("./"),
|
Err(_e) => PathBuf::from("./"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if !data_dir.exists()
|
if data_dir.exists() && data_dir.is_file()
|
||||||
|
{
|
||||||
|
panic!("Error: {} file already exists! Please (re)move it.",
|
||||||
|
data_dir.display());
|
||||||
|
}
|
||||||
|
else if !data_dir.exists()
|
||||||
{
|
{
|
||||||
println!("Creating {} data directory.", data_dir.display());
|
println!("Creating {} data directory.", data_dir.display());
|
||||||
fs::create_dir_all(data_dir)
|
fs::create_dir_all(data_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user