*** empty log message ***
This commit is contained in:
parent
1ab5a0f887
commit
a4facc93f0
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
package org.lwjgl;
|
package org.lwjgl;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.lwjgl.input.Controller;
|
import org.lwjgl.input.Controller;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
@ -225,5 +227,32 @@ public final class Sys {
|
||||||
* best attempt at opening the URL given - don't rely on it to work!
|
* best attempt at opening the URL given - don't rely on it to work!
|
||||||
* @param url The URL
|
* @param url The URL
|
||||||
*/
|
*/
|
||||||
public static native void openURL(String url);
|
public static void openURL(String url) {
|
||||||
|
String osName = System.getProperty("os.name");
|
||||||
|
if (osName.startsWith("Mac OS") || osName.startsWith("Windows")) {
|
||||||
|
// Mac and Windows both do this nicely from native code.
|
||||||
|
nOpenURL(url);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Linux may as well resort to pure Java hackery, as there's no Linux native way of doing it
|
||||||
|
// right anyway.
|
||||||
|
|
||||||
|
String[] browsers = {"mozilla", "opera", "konqueror", "galeon", "netscape", "lynx"};
|
||||||
|
|
||||||
|
for (int i = 0; i < browsers.length; i ++) {
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec(new String[] { browsers[i], url });
|
||||||
|
break;
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Ignore
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Where necessary, we use a native implementation of openURL.
|
||||||
|
*/
|
||||||
|
private static native void nOpenURL(String url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert
|
||||||
* Method: openURL
|
* Method: openURL
|
||||||
* Signature: (Ljava/lang/String;)V
|
* Signature: (Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_openURL
|
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_nOpenURL
|
||||||
(JNIEnv *, jclass, jstring);
|
(JNIEnv *, jclass, jstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -180,7 +180,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert(JNIEnv * env, jclass clazz, jstr
|
||||||
* Method: openURL
|
* Method: openURL
|
||||||
* Signature: (Ljava/lang/String;)V
|
* Signature: (Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_openURL
|
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_nOpenURL
|
||||||
(JNIEnv * env, jclass clazz, jstring url)
|
(JNIEnv * env, jclass clazz, jstring url)
|
||||||
{
|
{
|
||||||
const char * urlString = env->GetStringUTFChars(url, NULL);
|
const char * urlString = env->GetStringUTFChars(url, NULL);
|
||||||
|
|
|
@ -133,7 +133,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert(JNIEnv * env, jclass clazz, jstr
|
||||||
* Method: openURL
|
* Method: openURL
|
||||||
* Signature: (Ljava/lang/String;)V
|
* Signature: (Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_openURL
|
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_nOpenURL
|
||||||
(JNIEnv * env, jclass clazz, jstring url)
|
(JNIEnv * env, jclass clazz, jstring url)
|
||||||
{
|
{
|
||||||
const char * urlString = env->GetStringUTFChars(url, NULL);
|
const char * urlString = env->GetStringUTFChars(url, NULL);
|
||||||
|
|
|
@ -159,7 +159,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_getDirectBufferAddress
|
||||||
* Method: openURL
|
* Method: openURL
|
||||||
* Signature: (Ljava/lang/String;)V
|
* Signature: (Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_openURL
|
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_nOpenURL
|
||||||
(JNIEnv * env, jclass clazz, jstring url)
|
(JNIEnv * env, jclass clazz, jstring url)
|
||||||
{
|
{
|
||||||
const char * urlString = env->GetStringUTFChars(url, NULL);
|
const char * urlString = env->GetStringUTFChars(url, NULL);
|
||||||
|
|
Loading…
Reference in New Issue