summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-11-09 23:09:02 +0100
committerRay <[email protected]>2018-11-09 23:09:02 +0100
commit5167f78d5f64dfe2a4110102a0a7c1ca197d7c75 (patch)
tree5472620670400559918fcd8e5ff123a99fd33d11 /src/core.c
parent6428317739e1fe978e00527c2d2ea87c757a96db (diff)
downloadraylib-5167f78d5f64dfe2a4110102a0a7c1ca197d7c75.tar.gz
raylib-5167f78d5f64dfe2a4110102a0a7c1ca197d7c75.zip
ADDED: OpenURL()
Corrected bug on ImageDrawRectangleLines()
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 5f12fb72..da286923 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1819,6 +1819,27 @@ int StorageLoadValue(int position)
return value;
}
+// Open URL with default system browser (if available)
+void OpenURL(const char *url)
+{
+ // Max length is "explorer ".length + url.maxlength (which is 2083),
+ // but we are not wasting that much memory here... let's set it up to 512
+ static char cmd[512] = { 0 };
+
+#if defined(_WIN32)
+ strcpy(cmd, "explorer ");
+#elif defined(__linux__)
+ strcpy(cmd, "xdg-open "); // Alternatives: firefox, x-www-browser
+#elif defined(__APPLE__)
+ strcpy(cmd, "open ");
+#endif
+
+ strcat(cmd, url);
+ system(cmd);
+
+ memset(cmd, 0, 512);
+}
+
//----------------------------------------------------------------------------------
// Module Functions Definition - Input (Keyboard, Mouse, Gamepad) Functions
//----------------------------------------------------------------------------------