Skip to content

Commit bae9064

Browse files
committed
fix altsep
1 parent 503c91b commit bae9064

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

os/os.module.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ func getdevnull() py.String {
6666
return py.String("/dev/null")
6767
}
6868

69+
// getaltsep returns the alternative path seperator. This is set to '/' on Windows systems where sep is a backslash
70+
func getaltsep() py.Object {
71+
if runtime.GOOS == "windows" {
72+
return py.String("/")
73+
}
74+
return py.None
75+
}
76+
6977
func init() {
7078
methods := []*py.Method{
7179
py.MustNewMethod("getcwd", getCwd, 0, "Get the current working directory"),
@@ -86,7 +94,7 @@ func init() {
8694
"curdir": py.String("."),
8795
"pardir": py.String(".."),
8896
"extsep": py.String("."),
89-
"altsep": py.None,
97+
"altsep": getaltsep(),
9098
"pathsep": getpathsep(),
9199
"linesep": getlinesep(),
92100
"defpath": getdefpath(),

0 commit comments

Comments
 (0)