Skip to content
Snippets Groups Projects
Unverified Commit d1ff1365 authored by Daniel García's avatar Daniel García
Browse files

Merge branch 'stefan0xC-check-data-folder-permissions'

parents 736dbc95 46ec11de
No related branches found
No related tags found
No related merge requests found
......@@ -303,6 +303,10 @@ async fn check_data_folder() {
}
exit(1);
}
if !path.is_dir() {
error!("Data folder '{}' is not a directory.", data_folder);
exit(1);
}
if is_running_in_docker()
&& std::env::var("I_REALLY_WANT_VOLATILE_STORAGE").is_err()
......
//
// Web Headers and caching
//
use std::io::Cursor;
use std::io::{Cursor, ErrorKind};
use rocket::{
fairing::{Fairing, Info, Kind},
......@@ -326,7 +326,16 @@ pub fn file_exists(path: &str) -> bool {
pub fn write_file(path: &str, content: &[u8]) -> Result<(), crate::error::Error> {
use std::io::Write;
let mut f = File::create(path)?;
let mut f = match File::create(path) {
Ok(file) => file,
Err(e) => {
if e.kind() == ErrorKind::PermissionDenied {
error!("Can't create '{}': Permission denied", path);
}
return Err(From::from(e));
}
};
f.write_all(content)?;
f.flush()?;
Ok(())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment