From 2d846f2e2eec1fdd48cac15239991b6ec9def65a Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 29 Dec 2018 22:59:58 -0800 Subject: [PATCH] Fix duplicate file crash (#2) --- Makefile | 2 +- main.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1d17cf1..4f09e2b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DIST := \ mtmediasrv.conf PROJECT := mtmediasrv -VERSION = 4 +VERSION = 5 BUILD = `git describe --tags --always` $(PROJECT): main.go diff --git a/main.go b/main.go index ba96533..47e40fd 100644 --- a/main.go +++ b/main.go @@ -180,9 +180,13 @@ func collectMedia(l bool, c bool, e map[string]bool, w string) filepath.WalkFunc if l { err := os.Link(path, of) if err != nil { - return err + if err != os.ErrExist { + return err + } + } + if err != os.ErrExist { + newmedia++ } - newmedia++ } else if c { in, err := os.Open(path) if err != nil {