Skip to content

Commit

Permalink
remove stat
Browse files Browse the repository at this point in the history
  • Loading branch information
jokestax committed Nov 25, 2024
1 parent e128166 commit 490b878
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions cmd/k3d/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,8 @@ func destroyK3d(_ *cobra.Command, _ []string) error {
viper.WriteConfig()
}

if _, err := os.Stat(config.K1Dir); !os.IsNotExist(err) {
if err := os.RemoveAll(config.K1Dir); err != nil {
return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err)
}
if err := os.RemoveAll(config.K1Dir); err != nil {
return fmt.Errorf("unable to delete %q: %w", config.K1Dir, err)
}
time.Sleep(200 * time.Millisecond)
fmt.Printf("Your kubefirst platform running in %q has been destroyed.", k3d.CloudProvider)
Expand Down
6 changes: 2 additions & 4 deletions cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ func runReset() error {
return fmt.Errorf("error writing viper config: %w", err)
}

if _, err := os.Stat(k1Dir); !os.IsNotExist(err) {
if err := os.RemoveAll(k1Dir); err != nil {
return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir, err)
}
if err := os.RemoveAll(k1Dir); err != nil {
return fmt.Errorf("unable to delete %q folder, error: %w", k1Dir, err)
}

progressPrinter.IncrementTracker("removing-platform-content")
Expand Down

0 comments on commit 490b878

Please sign in to comment.