Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thenextman committed Sep 13, 2024
1 parent e1e8c4e commit 60b23bc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/controller/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@ WantedBy=multi-user.target"#,
.map_err(|e| Error::new(&format!("Failed to write {}: {}", path.display(), e)))?;

if let Some(ref config) = self.config {
let path = self
.get_service_dropin_dir()
let dropin_dir = self.get_service_dropin_dir();
let path = dropin_dir
.join(format!("{}.conf", self.service_name));
fs::create_dir(path.parent().unwrap())
.map_err(|e| Error::new(&format!("Failed to create {}: {}", path.display(), e)))?;

if !fs::exists(dropin_dir.clone()).map_err(|e| Error::new(""))? {
fs::create_dir(dropin_dir)
.map_err(|e| Error::new(&format!("Failed to create {}: {}", path.display(), e)))?;
}
info!("Writing config file {}", path.display());
File::create(&path)
.and_then(|mut file| file.write_all(config.as_bytes()))
Expand Down

0 comments on commit 60b23bc

Please sign in to comment.