fix #103: incorrect output path when input is a single file
This commit is contained in:
parent
77729cf653
commit
7f7cb66fe5
@ -121,13 +121,16 @@ func appMain(c *cli.Context) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var inputDir string
|
||||||
|
if inputStat.IsDir() {
|
||||||
|
inputDir = input
|
||||||
|
} else {
|
||||||
|
inputDir = path.Dir(input)
|
||||||
|
}
|
||||||
|
|
||||||
if output == "" {
|
if output == "" {
|
||||||
// Default to where the input is
|
// Default to where the input dir is
|
||||||
if inputStat.IsDir() {
|
output = inputDir
|
||||||
output = input
|
|
||||||
} else {
|
|
||||||
output = path.Dir(input)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStat, err := os.Stat(output)
|
outputStat, err := os.Stat(output)
|
||||||
@ -152,7 +155,7 @@ func appMain(c *cli.Context) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc := &processor{
|
proc := &processor{
|
||||||
inputDir: input,
|
inputDir: inputDir,
|
||||||
outputDir: output,
|
outputDir: output,
|
||||||
skipNoopDecoder: c.Bool("skip-noop"),
|
skipNoopDecoder: c.Bool("skip-noop"),
|
||||||
removeSource: c.Bool("remove-source"),
|
removeSource: c.Bool("remove-source"),
|
||||||
|
Loading…
Reference in New Issue
Block a user