diff options
author | Billy Biggs <bbiggs> | 2005-05-04 18:04:43 +0000 |
---|---|---|
committer | Billy Biggs <bbiggs> | 2005-05-04 18:04:43 +0000 |
commit | ada85491609763a78f43d2c381a8a8483bb15bfd (patch) | |
tree | 2796a6e8c9392ebc3654846c27c99735c9212d46 /bundles/org.eclipse.swt/Eclipse SWT Program | |
parent | ac7cf9c5eda86774b5be5c24fc760f690cf31185 (diff) | |
download | eclipse.platform.swt-ada85491609763a78f43d2c381a8a8483bb15bfd.tar.gz eclipse.platform.swt-ada85491609763a78f43d2c381a8a8483bb15bfd.tar.xz eclipse.platform.swt-ada85491609763a78f43d2c381a8a8483bb15bfd.zip |
71234
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Program')
6 files changed, 54 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c index e8d7d36fc7..32a0983526 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c @@ -209,6 +209,22 @@ JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1init) } #endif +#ifndef NO__1gnome_1vfs_1make_1uri_1from_1input +JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jint rc = 0; + GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1make_1uri_1from_1input_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + rc = (jint)gnome_vfs_make_uri_from_input((const char *)lparg0); +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1make_1uri_1from_1input_FUNC); + return rc; +} +#endif + #ifndef NO__1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs) (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1) @@ -218,12 +234,12 @@ JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input_1with_1 GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_FUNC); if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; /* - rc = (jint)gnome_vfs_make_uri_from_input_with_dirs(lparg0, arg1); + rc = (jint)gnome_vfs_make_uri_from_input_with_dirs((const char *)lparg0, arg1); */ { static int initialized = 0; static void *handle = NULL; - typedef jint (*FPTR)(jbyte *, jint); + typedef jint (*FPTR)(const char *, jint); static FPTR fptr; rc = 0; if (!initialized) { @@ -232,7 +248,7 @@ JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input_1with_1 initialized = 1; } if (fptr) { - rc = (jint)(*fptr)(lparg0, arg1); + rc = (jint)(*fptr)((const char *)lparg0, arg1); } } fail: diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c index 3a9120ca42..f77f8f7124 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int GNOME_nativeFunctionCount = 24; -int GNOME_nativeFunctionCallCount[24]; +int GNOME_nativeFunctionCount = 25; +int GNOME_nativeFunctionCallCount[25]; char * GNOME_nativeFunctionNames[] = { "GnomeVFSMimeApplication_1sizeof", "_1dlclose", @@ -35,6 +35,7 @@ char * GNOME_nativeFunctionNames[] = { "_1gnome_1icon_1theme_1new", "_1gnome_1vfs_1get_1registered_1mime_1types", "_1gnome_1vfs_1init", + "_1gnome_1vfs_1make_1uri_1from_1input", "_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs", "_1gnome_1vfs_1mime_1application_1free", "_1gnome_1vfs_1mime_1application_1launch", diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h index 7c9c2436e0..3f2c7668fd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h @@ -39,6 +39,7 @@ typedef enum { _1gnome_1icon_1theme_1new_FUNC, _1gnome_1vfs_1get_1registered_1mime_1types_FUNC, _1gnome_1vfs_1init_FUNC, + _1gnome_1vfs_1make_1uri_1from_1input_FUNC, _1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_FUNC, _1gnome_1vfs_1mime_1application_1free_FUNC, _1gnome_1vfs_1mime_1application_1launch_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java index ba5c60dd7e..c80d736b63 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java @@ -148,6 +148,15 @@ public static final boolean gnome_vfs_init() { lock.unlock(); } } +public static final native int /*long*/ _gnome_vfs_make_uri_from_input(byte[] uri); +public static final int /*long*/ gnome_vfs_make_uri_from_input(byte[] uri) { + lock.lock(); + try { + return _gnome_vfs_make_uri_from_input(uri); + } finally { + lock.unlock(); + } +} public static final native int /*long*/ _gnome_vfs_make_uri_from_input_with_dirs(byte[] uri, int dirs); public static final int /*long*/ gnome_vfs_make_uri_from_input_with_dirs(byte[] uri, int dirs) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java index df4f8c0a96..58b0aae438 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java @@ -366,7 +366,17 @@ static boolean gnome_24_launch(String fileName) { boolean gnome_execute(String fileName) { if (gnomeExpectUri) { /* Convert the given path into a URL */ - fileName = "file://" + fileName; + byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); + int /*long*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer); + if (uri != 0) { + int length = OS.strlen(uri); + if (length > 0) { + byte[] buffer = new byte[length]; + OS.memmove(buffer, uri, length); + fileName = new String(Converter.mbcsToWcs(null, buffer)); + } + GNOME.g_free(uri); + } } /* Parse the command into its individual arguments. */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java index 54ea4e3070..593f994794 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java @@ -400,7 +400,17 @@ static boolean gnome_24_launch(String fileName) { boolean gnome_execute(String fileName) { if (gnomeExpectUri) { /* Convert the given path into a URL */ - fileName = "file://" + fileName; + byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); + int /*long*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer); + if (uri != 0) { + int length = OS.strlen(uri); + if (length > 0) { + byte[] buffer = new byte[length]; + OS.memmove(buffer, uri, length); + fileName = new String(Converter.mbcsToWcs(null, buffer)); + } + GNOME.g_free(uri); + } } /* Parse the command into its individual arguments. */ |