Browse Source

Merge branch 'master' of github.com:odin-lang/Odin

Kevin Watters 6 years ago
parent
commit
6ab471ff87
1 changed files with 29 additions and 0 deletions
  1. 29 0
      core/sys/win32/helpers.odin

+ 29 - 0
core/sys/win32/helpers.odin

@@ -0,0 +1,29 @@
+// +build windows
+package win32
+
+import "core:strings";
+
+call_external_process :: proc(program, command_line: string) -> bool {
+    si := Startup_Info{ cb=size_of(Startup_Info) };
+    pi := Process_Information{};
+
+    return cast(bool)create_process_w(
+        utf8_to_wstring(program),
+        utf8_to_wstring(command_line),
+        nil, 
+        nil, 
+        Bool(false), 
+        u32(0x10), 
+        nil, 
+        nil, 
+        &si, 
+        &pi
+    );
+}
+
+open_website :: proc(url: string) -> bool {
+	p :: "C:\\Windows\\System32\\cmd.exe";
+	arg := []string{"/C", "start", url};
+	args := strings.join(arg, " ", context.temp_allocator);
+	return call_external_process(p, args);
+}