Simplifying cleanExtensionUpdateDir logic
This function was doing some unnecessary heavy lifting detecting if the directory being deleted actually existed when `os.RemoveAll()` would handle directories that exist or not.
This commit is contained in:
parent
20062233c8
commit
97eb8a194e
1 changed files with 1 additions and 8 deletions
|
|
@ -851,14 +851,7 @@ func codesignBinary(binPath string) error {
|
|||
|
||||
// cleanExtensionUpdateDir deletes extension state directory to avoid problems reinstalling extensions.
|
||||
func (m *Manager) cleanExtensionUpdateDir(name string) error {
|
||||
updatePath := m.UpdateDir(name)
|
||||
if _, err := os.Stat(updatePath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("failed to check previous extension update state: %w", err)
|
||||
}
|
||||
if err := os.RemoveAll(updatePath); err != nil {
|
||||
if err := os.RemoveAll(m.UpdateDir(name)); err != nil {
|
||||
return fmt.Errorf("failed to remove previous extension update state: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue