Fix some windows edgecases

This commit is contained in:
kolaente 2020-09-16 20:20:01 +02:00
parent 7367693c6e
commit 0ac4cafe8b
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 2 deletions

View File

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