Skip to content

Commit

Permalink
fixed windows code binding
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Feb 10, 2024
1 parent cfd26cd commit aea7b91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions code/code/argvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"bytes"
"fmt"
"path/filepath"
"runtime"
"strings"

"cogentcore.org/core/goosi"
"cogentcore.org/core/texteditor"
)

Expand Down Expand Up @@ -213,10 +213,8 @@ func (avp *ArgVarVals) Bind(arg string) string {
bs = bytes.Replace(bs, []byte("\\{"), []byte("{"), -1)
}

if goosi.TheApp != nil {
if goosi.TheApp.Platform() == goosi.Windows {
bs = bytes.Replace(bs, []byte("}/{"), []byte("}\\{"), -1)
}
if runtime.GOOS == "windows" {
bs = bytes.ReplaceAll(bs, []byte("/"), []byte("\\"))
}
return string(bs)
}
Expand Down
2 changes: 1 addition & 1 deletion code/code/argvars_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestBind(t *testing.T) {
}

bv = avp.Bind("{FileDir}/{Filename}")
cv = "code/argvars_test.go"
cv = filepath.Join("code", "argvars_test.go")
if bv != cv {
t.Errorf("bind error: should have been: %v was: %v\n", cv, bv)
}
Expand Down

0 comments on commit aea7b91

Please sign in to comment.