Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/dfx/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ pub fn exec(env: &dyn Environment, args: &ArgMatches<'_>) -> DfxResult {
// Clean the contents of the provided directory including the
// directory itself. N.B. This does NOT follow symbolic links -- and I
// hope we do not need to.
fs::remove_dir_all(state_root.clone()).map_err(DfxError::CleanState)?;
fs::remove_dir_all(temp_dir.join("local")).map_err(DfxError::CleanState)?;
if state_root.is_dir() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just exists()? If it's a file you're doing something wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both are fine. If it's a file, you have a lot of opportunities to get the error later in the process, which may give more meaningful error message?

fs::remove_dir_all(state_root.clone()).map_err(DfxError::CleanState)?;
}
let local_dir = temp_dir.join("local");
if local_dir.is_dir() {
fs::remove_dir_all(local_dir).map_err(DfxError::CleanState)?;
}
}

let client_configuration_dir = temp_dir.join("client-configuration");
Expand Down