forked from Elara6331/infinitime
Stop DBus errors from causing panics by checking error type (Arsen6331/itd#29)
This commit is contained in:
parent
01970b2bb7
commit
bb017b471e
24
blefs/all.go
24
blefs/all.go
@ -23,7 +23,13 @@ func (blefs *FS) RemoveAll(path string) error {
|
||||
return blefs.removeAllChildren(path)
|
||||
} else {
|
||||
err = blefs.Remove(path)
|
||||
if err != nil && err.(FSError).Code != -2 {
|
||||
|
||||
var code int8
|
||||
if err, ok := err.(FSError); ok {
|
||||
code = err.Code
|
||||
}
|
||||
|
||||
if err != nil && code != -2 {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -50,7 +56,13 @@ func (blefs *FS) removeAllChildren(path string) error {
|
||||
} else {
|
||||
err = blefs.Remove(entryPath)
|
||||
}
|
||||
if err != nil && err.(FSError).Code != -2 {
|
||||
|
||||
var code int8
|
||||
if err, ok := err.(FSError); ok {
|
||||
code = err.Code
|
||||
}
|
||||
|
||||
if err != nil && code != -2 {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -68,7 +80,13 @@ func (blefs *FS) MkdirAll(path string) error {
|
||||
curPath := strings.Join(splitPath[0:i+1], "/")
|
||||
|
||||
err := blefs.Mkdir(curPath)
|
||||
if err != nil && err.(FSError).Code != -17 {
|
||||
|
||||
var code int8
|
||||
if err, ok := err.(FSError); ok {
|
||||
code = err.Code
|
||||
}
|
||||
|
||||
if err != nil && code != -17 {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user