Properly remove bad profile dir
This commit is contained in:
parent
b13a56d1db
commit
bf4cca631c
|
@ -129,7 +129,7 @@ func (app *application) AddPeerPlugin(onion string, pluginID plugins.PluginID) {
|
||||||
func (app *application) ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error) {
|
func (app *application) ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error) {
|
||||||
profileDirectory := path.Join(app.directory, "profiles")
|
profileDirectory := path.Join(app.directory, "profiles")
|
||||||
profile, err := peer.ImportProfile(exportedCwtchFile, profileDirectory, password)
|
profile, err := peer.ImportProfile(exportedCwtchFile, profileDirectory, password)
|
||||||
if err == nil {
|
if profile != nil || err == nil {
|
||||||
app.installProfile(profile)
|
app.installProfile(profile)
|
||||||
}
|
}
|
||||||
return profile, err
|
return profile, err
|
||||||
|
|
|
@ -191,7 +191,8 @@ func ImportProfile(exportedCwtchFile string, profilesDir string, password string
|
||||||
return profile, err
|
return profile, err
|
||||||
}
|
}
|
||||||
// Otherwise purge
|
// Otherwise purge
|
||||||
os.RemoveAll(filepath.Join(profilesDir, profileDir))
|
log.Errorf("error importing profile: %v. removing %s", err, profileDir)
|
||||||
|
os.RemoveAll(profileDir)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue