From aea7b915b4bbdeac6ef7153aa5404b04002a4052 Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Sat, 10 Feb 2024 12:21:43 -0800 Subject: [PATCH] fixed windows code binding --- code/code/argvars.go | 8 +++----- code/code/argvars_test.go | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/code/code/argvars.go b/code/code/argvars.go index fdb38e13..e590fa9f 100644 --- a/code/code/argvars.go +++ b/code/code/argvars.go @@ -8,9 +8,9 @@ import ( "bytes" "fmt" "path/filepath" + "runtime" "strings" - "cogentcore.org/core/goosi" "cogentcore.org/core/texteditor" ) @@ -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) } diff --git a/code/code/argvars_test.go b/code/code/argvars_test.go index 6e570344..cd096e91 100644 --- a/code/code/argvars_test.go +++ b/code/code/argvars_test.go @@ -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) }