"flag"
"fmt"
"io"
+ "io/fs"
"log"
"os"
"path/filepath"
}
ctx.LogD("xfer-self", les, logMsg)
if _, err = os.Stat(selfPath); err != nil {
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
ctx.LogD("xfer-self-no-dir", les, func(les nncp.LEs) string {
return logMsg(les) + ": no directory"
})
string(nncp.TRx),
nncp.SeenDir,
fiInt.Name(),
- )); err == nil || !os.IsNotExist(err) {
+ )); err == nil || !errors.Is(err, fs.ErrNotExist) {
ctx.LogI("xfer-rx-seen", les, func(les nncp.LEs) string {
return logMsg(les) + ": packet already seen"
})
}
_, err = os.Stat(nodePath)
if err != nil {
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
ctx.LogD("xfer-tx-not-exist", les, func(les nncp.LEs) string {
return logMsg(les) + ": does not exist"
})
}
_, err = os.Stat(dstPath)
if err != nil {
- if os.IsNotExist(err) {
+ if errors.Is(err, fs.ErrNotExist) {
if err = os.Mkdir(dstPath, os.FileMode(0777)); err != nil {
ctx.UnlockDir(dirLock)
ctx.LogE("xfer-tx-mkdir", les, err, logMsg)
})
continue
}
- if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !os.IsNotExist(err) {
+ if _, err = os.Stat(filepath.Join(dstPath, pktName)); err == nil || !errors.Is(err, fs.ErrNotExist) {
ctx.LogD("xfer-tx-exists", les, func(les nncp.LEs) string {
return logMsg(les) + ": already exists"
})