Skip to content

Commit

Permalink
fix(libparsec): Ignore error to create log dir
Browse files Browse the repository at this point in the history
Fix #9610
  • Loading branch information
FirelightFlagboy committed Feb 11, 2025
1 parent a9abbbc commit d88740a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions libparsec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,15 @@ fn init_logger(config: &ClientConfig) {
// TODO: ClientConfig should provide the log directory to use
// https://github.com/Scille/parsec-cloud/issues/9580
config.config_dir.join("libparsec.log"));
log_file_path
.parent()
.map(std::fs::create_dir_all)
.transpose()
.expect("Cannot create log directory");
let parent = log_file_path.parent();
if let Err(e) = parent.map(std::fs::create_dir_all).transpose() {
eprintln!(
"Failed to create log directory {}: {e}",
parent.unwrap_or_else(|| std::path::Path::new("")).display()
);
eprintln!("The logger will be disabled");
return;
}
let log_file = std::fs::OpenOptions::new()
.create(true)
.write(true)
Expand Down

0 comments on commit d88740a

Please sign in to comment.