Skip to content

Commit

Permalink
cmd: allow forward and backward slashes for Windows platform, fixes #726
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Jul 10, 2024
1 parent 767148c commit f50b46a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/minify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ type Task struct {

// NewTask returns a new Task.
func NewTask(root, input, output string, sync bool) (Task, error) {
if len(output) != 0 && (output == "." || output[len(output)-1] == os.PathSeparator) {
if len(output) != 0 && (output == "." || output[len(output)-1] == os.PathSeparator || output[len(output)-1] == '/') {
rel, err := filepath.Rel(root, input)
if err != nil {
return Task{}, err
Expand Down Expand Up @@ -400,15 +400,15 @@ func run() int {
return 1
}
inputs[i] = filepath.Clean(input)
if input[len(input)-1] == os.PathSeparator {
if input[len(input)-1] == os.PathSeparator || input[len(input)-1] == '/' {
inputs[i] += string(os.PathSeparator)
}
}

// set output file or directory, empty means stdout
dirDst := false
if output != "" {
if 0 < len(output) && output[len(output)-1] == os.PathSeparator {
if 0 < len(output) && (output[len(output)-1] == os.PathSeparator || output[len(output)-1] == '/') {
dirDst = true
} else if !bundle && 1 < len(inputs) {
dirDst = true
Expand Down

0 comments on commit f50b46a

Please sign in to comment.