From 7bd7bcfcdf98d6a3864580e925b33d24ea75ae77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20B=C5=82aszczyk?= Date: Fri, 3 Jan 2014 18:46:33 +0100 Subject: [PATCH] Fix for ignored trailing path separator in prefix. --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index 8682966..bce5d01 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( "os" "path" "path/filepath" + "strings" "unicode" ) @@ -90,7 +91,14 @@ func parseArgs() { pipe = flag.NArg() == 0 if !pipe { + sepsuffix := false + if strings.HasSuffix(*prefix, string(filepath.Separator)) { + sepsuffix = true + } *prefix, _ = filepath.Abs(filepath.Clean(*prefix)) + if sepsuffix { + *prefix += string(filepath.Separator) + } in, _ = filepath.Abs(filepath.Clean(flag.Args()[0])) *out = safeFilename(*out, in) }