Compare commits
2 Commits
master
...
andy/direc
Author | SHA1 | Date | |
---|---|---|---|
d8404a5030 | |||
98dab06b06 |
@ -15,6 +15,17 @@ use entity::item::{NewItemEntity, ItemDetail, InventoryItemEntity};
|
|||||||
use entity::item;
|
use entity::item;
|
||||||
|
|
||||||
fn setup_logger() {
|
fn setup_logger() {
|
||||||
|
match std::fs::create_dir(std::path::Path::new("log")) {
|
||||||
|
Ok(_) => {},
|
||||||
|
Err(e) => match e.kind() {
|
||||||
|
std::io::ErrorKind::AlreadyExists => {},
|
||||||
|
_ => {
|
||||||
|
println!("Error creating log directory. Error: {}", e); // Probably a permission issue
|
||||||
|
return; // Continue without logging into a file
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let colors = fern::colors::ColoredLevelConfig::new()
|
let colors = fern::colors::ColoredLevelConfig::new()
|
||||||
.error(fern::colors::Color::Red)
|
.error(fern::colors::Color::Red)
|
||||||
.warn(fern::colors::Color::Yellow)
|
.warn(fern::colors::Color::Yellow)
|
||||||
|
@ -217,7 +217,13 @@ impl ServerState for PatchServerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn load_patch_dir(basedir: &str, patchbase: &str, file_ids: &mut HashMap<u32, PatchFile>) -> PatchFileTree {
|
fn load_patch_dir(basedir: &str, patchbase: &str, file_ids: &mut HashMap<u32, PatchFile>) -> PatchFileTree {
|
||||||
let paths = fs::read_dir(basedir).expect("could not read directory");
|
let paths = match fs::read_dir(basedir) {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(_) => {
|
||||||
|
fs::create_dir_all(basedir).expect(&format!("Patch directory \"{}\" is missing and could not be created.", basedir));
|
||||||
|
fs::read_dir(basedir).expect(&format!("Patch directory \"{}\" was created but could not be read!", basedir)) // how ??
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
let mut files = Vec::new();
|
let mut files = Vec::new();
|
||||||
let mut dirs = Vec::new();
|
let mut dirs = Vec::new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user