Fix some windows edgecases
This commit is contained in:
parent
7367693c6e
commit
0ac4cafe8b
9
main.go
9
main.go
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -43,13 +44,17 @@ func main() {
|
|||
workingDir = cwd
|
||||
}
|
||||
|
||||
outPath := path.Join(workingDir, "qrcodes")
|
||||
outPath := filepath.Dir(path.Join(workingDir, "qrcodes"))
|
||||
if err := os.MkdirAll(outPath, os.ModePerm); err != nil {
|
||||
handleErr("Could not create output folder: %s", err)
|
||||
}
|
||||
|
||||
// 2. Get Files
|
||||
files, err := filepath.Glob(workingDir + "/*.txt")
|
||||
glob := workingDir + "/*.txt"
|
||||
if runtime.GOOS == "windows" {
|
||||
glob = workingDir + "\\*.txt"
|
||||
}
|
||||
files, err := filepath.Glob(glob)
|
||||
if err != nil {
|
||||
handleErr("Could not get files: %s", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue