Fix for ignored trailing path separator in prefix.

pull/4/head
Paweł Błaszczyk 2014-01-03 18:46:33 +01:00
parent 79847ab3e9
commit 7bd7bcfcdf
1 changed files with 8 additions and 0 deletions

View File

@ -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)
}