1 package name 2 3 import ( 4 "path/filepath" 5 "runtime" 6 "strings" 7 ) 8 9 func OsPath(s string) string { 10 return New(s).OsPath().String() 11 } 12 13 func (i Ident) OsPath() Ident { 14 s := i.String() 15 if runtime.GOOS == "windows" { 16 s = strings.Replace(s, "/", string(filepath.Separator), -1) 17 } else { 18 s = strings.Replace(s, "\\", string(filepath.Separator), -1) 19 } 20 return New(s) 21 } 22