Fix for ignored trailing path separator in prefix.
This commit is contained in:
parent
79847ab3e9
commit
7bd7bcfcdf
8
main.go
8
main.go
|
@ -11,6 +11,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,7 +91,14 @@ func parseArgs() {
|
||||||
pipe = flag.NArg() == 0
|
pipe = flag.NArg() == 0
|
||||||
|
|
||||||
if !pipe {
|
if !pipe {
|
||||||
|
sepsuffix := false
|
||||||
|
if strings.HasSuffix(*prefix, string(filepath.Separator)) {
|
||||||
|
sepsuffix = true
|
||||||
|
}
|
||||||
*prefix, _ = filepath.Abs(filepath.Clean(*prefix))
|
*prefix, _ = filepath.Abs(filepath.Clean(*prefix))
|
||||||
|
if sepsuffix {
|
||||||
|
*prefix += string(filepath.Separator)
|
||||||
|
}
|
||||||
in, _ = filepath.Abs(filepath.Clean(flag.Args()[0]))
|
in, _ = filepath.Abs(filepath.Clean(flag.Args()[0]))
|
||||||
*out = safeFilename(*out, in)
|
*out = safeFilename(*out, in)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user