diff --git a/src/installer/commands/make_directory_command.rs b/src/installer/commands/make_directory_command.rs index 2cf751a..ae6a097 100644 --- a/src/installer/commands/make_directory_command.rs +++ b/src/installer/commands/make_directory_command.rs @@ -17,10 +17,18 @@ impl MakeDirectoryCommand { } /// # Errors - /// Returns an error if the command execution fails. + /// Returns an error if the command execution fails, unless the path already exists pub fn execute(&self, cleanup_file: &mut dyn Write) -> Result<()> { - fs::create_dir(&self.directory)?; - writeln!(cleanup_file, "{}", self.directory.display())?; + match fs::create_dir(&self.directory) { + Ok(()) => { + writeln!(cleanup_file, "{}", self.directory.display())?; + } + Err(e) + if e.kind() == std::io::ErrorKind::AlreadyExists + && self.directory.is_dir() => {} + Err(e) => return Err(e.into()), + } + Ok(()) }