Skip to content

Commit 6967e6e

Browse files
author
Yves Ulrich Tittes
committed
feat: made atlas acquisition windows compatible
1 parent 5939922 commit 6967e6e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

main.go

+15-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"os"
1111
"path/filepath"
1212
"regexp"
13+
"runtime"
1314
"strings"
1415
"sync"
1516
)
@@ -298,13 +299,21 @@ func getAtlas(yPath string, atlas string, xPath string) error {
298299
fmt.Println("Error:", err)
299300
return err
300301
}
301-
// Change the Windows path to a linux one (if required) and change drive D:\ start to mountpoint *aFlag
302-
atlasdm := strings.ReplaceAll(value, `\`, string(filepath.Separator))
303-
if len(atlasdm) > 1 && atlasdm[1] == ':' {
304-
atlasdm = atlasdm[2:]
302+
var fullpath string
303+
// if os windows just use path
304+
switch runtime.GOOS {
305+
case "windows":
306+
fullpath = value
307+
// if os not windows change the Windows path to a linux one (if required) and change drive D:\ start to mountpoint *aFlag
308+
default:
309+
atlasdm := strings.ReplaceAll(value, `\`, string(filepath.Separator))
310+
if len(atlasdm) > 1 && atlasdm[1] == ':' {
311+
atlasdm = atlasdm[2:]
312+
}
313+
fullpath = atlas + atlasdm
305314
}
306-
full := atlas + atlasdm
307-
targetpath := filepath.Dir(full)
315+
316+
targetpath := filepath.Dir(fullpath)
308317
atlas_re := `^Atlas_.*\.mrc$`
309318
find := regexp.MustCompile(atlas_re)
310319
test, errtest := os.ReadDir(targetpath)

0 commit comments

Comments
 (0)