]> Cypherpunks.ru repositories - nncp.git/commitdiff
Do not fail if directory does not exist
authorSergey Matveev <stargrave@stargrave.org>
Wed, 3 Nov 2021 18:32:37 +0000 (21:32 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 3 Nov 2021 18:32:37 +0000 (21:32 +0300)
src/cmd/nncp-rm/main.go

index b9ca28977c7380834393c7709cc585a9e95a1238..25110f82fc83e568787d847796e15375a6ada0e5 100644 (file)
@@ -186,8 +186,11 @@ func main() {
                        continue
                }
                remove := func(xx nncp.TRxTx) error {
                        continue
                }
                remove := func(xx nncp.TRxTx) error {
-                       return filepath.Walk(
-                               filepath.Join(ctx.Spool, node.Id.String(), string(xx)),
+                       p := filepath.Join(ctx.Spool, node.Id.String(), string(xx))
+                       if _, err := os.Stat(p); err != nil && os.IsNotExist(err) {
+                               return nil
+                       }
+                       return filepath.Walk(p,
                                func(path string, info os.FileInfo, err error) error {
                                        if err != nil {
                                                return err
                                func(path string, info os.FileInfo, err error) error {
                                        if err != nil {
                                                return err