Skip to content

Commit

Permalink
refactor: deduplicate storage of original canonicalized path
Browse files Browse the repository at this point in the history
  • Loading branch information
ysndr committed Apr 23, 2024
1 parent d8c510f commit b45a34d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions cli/flox-rust-sdk/src/models/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,8 @@ pub enum EnvironmentError {
#[error("could not get current directory")]
GetCurrentDir(#[source] std::io::Error),

#[error("failed to get canonical path for '.flox' directory: {path}")]
CanonicalDotFlox {
err: CanonicalizeError,
path: PathBuf,
},
#[error("failed to get canonical path for '.flox' directory")]
CanonicalDotFlox(#[source] CanonicalizeError),

#[error("failed to access the environment registry")]
Registry(#[from] EnvRegistryError),
Expand Down
6 changes: 2 additions & 4 deletions cli/flox-rust-sdk/src/models/environment/path_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,8 @@ impl PathEnvironment {
}

let canonical_dot_flox =
CanonicalPath::new(&dot_flox_path).map_err(|e| EnvironmentError::CanonicalDotFlox {
err: e,
path: dot_flox_path.as_ref().to_path_buf(),
})?;
CanonicalPath::new(&dot_flox_path).map_err(EnvironmentError::CanonicalDotFlox)?;

ensure_registered(
flox,
&canonical_dot_flox,
Expand Down

0 comments on commit b45a34d

Please sign in to comment.