Skip to content

Commit

Permalink
fix: don't abort with ConfigError if dir to be created already exists
Browse files Browse the repository at this point in the history
Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
  • Loading branch information
blurgyy committed Jun 8, 2022
1 parent cb51e99 commit 71ae07e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dt-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ where

// 2. Path to staging root contains readonly parent directory
// NOTE: Must convert to an absolute path before checking readonly
if staging_path.absolute()?.is_parent_readonly() {
if !staging_path.exists() && staging_path.absolute()?.is_parent_readonly() {
return Err(AppError::ConfigError(
"staging root path cannot be created due to insufficient permissions"
.to_owned(),
Expand All @@ -908,7 +908,7 @@ where

// 4. Path to target contains readonly parent directory
// NOTE: Must convert to an absolute path before checking readonly
if self.target.to_owned().absolute()?.is_parent_readonly() {
if !self.target.exists() && self.target.to_owned().absolute()?.is_parent_readonly() {
return Err(AppError::ConfigError(format!(
"target path cannot be created due to insufficient permissions in group '{}'",
self.name,
Expand Down

0 comments on commit 71ae07e

Please sign in to comment.