summaryrefslogtreecommitdiff
path: root/libgo/go/os/env_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/env_windows.go')
-rw-r--r--libgo/go/os/env_windows.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libgo/go/os/env_windows.go b/libgo/go/os/env_windows.go
index 6908a9ca85b..d2b159dfba7 100644
--- a/libgo/go/os/env_windows.go
+++ b/libgo/go/os/env_windows.go
@@ -111,3 +111,17 @@ func TempDir() string {
}
return string(utf16.Decode(dirw[0:n]))
}
+
+func init() {
+ var argc int32
+ cmd := syscall.GetCommandLine()
+ argv, e := syscall.CommandLineToArgv(cmd, &argc)
+ if e != 0 {
+ return
+ }
+ defer syscall.LocalFree(uint32(uintptr(unsafe.Pointer(argv))))
+ Args = make([]string, argc)
+ for i, v := range (*argv)[:argc] {
+ Args[i] = string(syscall.UTF16ToString((*v)[:]))
+ }
+}