From 8b7a7649fc88fc16b49decc50a36c7d3540174c6 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 2 Jan 2019 21:41:39 -0800 Subject: [PATCH] v6: properly handle os.IsExist(). --- Makefile | 2 +- main.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4f09e2b..9709ff2 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DIST := \ mtmediasrv.conf PROJECT := mtmediasrv -VERSION = 5 +VERSION = 6 BUILD = `git describe --tags --always` $(PROJECT): main.go diff --git a/main.go b/main.go index 47e40fd..cce9274 100644 --- a/main.go +++ b/main.go @@ -180,13 +180,12 @@ func collectMedia(l bool, c bool, e map[string]bool, w string) filepath.WalkFunc if l { err := os.Link(path, of) if err != nil { - if err != os.ErrExist { - return err + if os.IsExist(err) { + return nil } + return err } - if err != os.ErrExist { - newmedia++ - } + newmedia++ } else if c { in, err := os.Open(path) if err != nil {