aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe2010-04-22 12:37:25 -0400
committerBogdan Gheorghe2010-04-22 12:37:25 -0400
commit3dbca50e1d527f9d970adadbc94c490ef4ed4b08 (patch)
tree0fda41d9e48bb45e632d30e95dee32e644a9c050
parent14120886fce522b10b4a78abec3834ceb820f1f5 (diff)
downloadeclipse.platform.swt-3dbca50e1d527f9d970adadbc94c490ef4ed4b08.tar.gz
eclipse.platform.swt-3dbca50e1d527f9d970adadbc94c490ef4ed4b08.tar.xz
eclipse.platform.swt-3dbca50e1d527f9d970adadbc94c490ef4ed4b08.zip
305124 [Program] Eclipse can not open resource files in external editor
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java44
10 files changed, 185 insertions, 41 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 55e8a9781d..e1f3b08686 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -2737,6 +2737,30 @@ JNIEXPORT void JNICALL OS_NATIVE(_1g_1closure_1unref)
}
#endif
+#ifndef NO__1g_1content_1type_1equals
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1content_1type_1equals)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1content_1type_1equals_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+/*
+ rc = (jboolean)g_content_type_equals(arg0, lparg1);
+*/
+ {
+ LOAD_FUNCTION(fp, g_content_type_equals)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1content_1type_1equals_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1content_1type_1get_1mime_1type
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1content_1type_1get_1mime_1type)
(JNIEnv *env, jclass that, jbyteArray arg0)
@@ -2761,6 +2785,30 @@ fail:
}
#endif
+#ifndef NO__1g_1content_1type_1is_1a
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1content_1type_1is_1a)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1content_1type_1is_1a_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+/*
+ rc = (jboolean)g_content_type_is_a(arg0, lparg1);
+*/
+ {
+ LOAD_FUNCTION(fp, g_content_type_is_a)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jbyte *))fp)(arg0, lparg1);
+ }
+ }
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1content_1type_1is_1a_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1content_1types_1get_1registered
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1content_1types_1get_1registered)
(JNIEnv *env, jclass that)
@@ -2909,6 +2957,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1icon_1get_1file)
}
#endif
+#ifndef NO__1g_1file_1info_1get_1content_1type
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1info_1get_1content_1type)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1file_1info_1get_1content_1type_FUNC);
+/*
+ rc = (jintLong)g_file_info_get_content_type(arg0);
+*/
+ {
+ LOAD_FUNCTION(fp, g_file_info_get_content_type)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1g_1file_1info_1get_1content_1type_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1file_1info_1get_1modification_1time
JNIEXPORT void JNICALL OS_NATIVE(_1g_1file_1info_1get_1modification_1time)
(JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index 5536099fff..26ce0edc93 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -231,12 +231,15 @@
#define g_app_info_should_show_LIB "libgio-2.0.so.0"
#define g_data_input_stream_new_LIB "libgio-2.0.so.0"
#define g_data_input_stream_read_line_LIB "libgio-2.0.so.0"
+#define g_content_type_equals_LIB "libgio-2.0.so.0"
#define g_content_type_get_mime_type_LIB "libgio-2.0.so.0"
+#define g_content_type_is_a_LIB "libgio-2.0.so.0"
#define g_content_types_get_registered_LIB "libgio-2.0.so.0"
#define g_desktop_app_info_new_from_filename_LIB "libgio-2.0.so.0"
#define g_file_get_path_LIB "libgio-2.0.so.0"
#define g_file_get_uri_LIB "libgio-2.0.so.0"
#define g_file_icon_get_file_LIB "libgio-2.0.so.0"
+#define g_file_info_get_content_type_LIB "libgio-2.0.so.0"
#define g_file_info_get_modification_time_LIB "libgio-2.0.so.0"
#define g_file_new_for_path_LIB "libgio-2.0.so.0"
#define g_file_read_LIB "libgio-2.0.so.0"
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index e4e5dd65d4..2bbc036bfc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1361;
-int OS_nativeFunctionCallCount[1361];
+int OS_nativeFunctionCount = 1364;
+int OS_nativeFunctionCallCount[1364];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -233,7 +233,9 @@ char * OS_nativeFunctionNames[] = {
"_1g_1cclosure_1new",
"_1g_1closure_1ref",
"_1g_1closure_1unref",
+ "_1g_1content_1type_1equals",
"_1g_1content_1type_1get_1mime_1type",
+ "_1g_1content_1type_1is_1a",
"_1g_1content_1types_1get_1registered",
"_1g_1data_1input_1stream_1new",
"_1g_1data_1input_1stream_1read_1line",
@@ -241,6 +243,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1file_1get_1path",
"_1g_1file_1get_1uri",
"_1g_1file_1icon_1get_1file",
+ "_1g_1file_1info_1get_1content_1type",
"_1g_1file_1info_1get_1modification_1time",
"_1g_1file_1new_1for_1path",
"_1g_1file_1query_1info",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 90a3fb54b1..c7ba2e0674 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -241,7 +241,9 @@ typedef enum {
_1g_1cclosure_1new_FUNC,
_1g_1closure_1ref_FUNC,
_1g_1closure_1unref_FUNC,
+ _1g_1content_1type_1equals_FUNC,
_1g_1content_1type_1get_1mime_1type_FUNC,
+ _1g_1content_1type_1is_1a_FUNC,
_1g_1content_1types_1get_1registered_FUNC,
_1g_1data_1input_1stream_1new_FUNC,
_1g_1data_1input_1stream_1read_1line_FUNC,
@@ -249,6 +251,7 @@ typedef enum {
_1g_1file_1get_1path_FUNC,
_1g_1file_1get_1uri_FUNC,
_1g_1file_1icon_1get_1file_FUNC,
+ _1g_1file_1info_1get_1content_1type_FUNC,
_1g_1file_1info_1get_1modification_1time_FUNC,
_1g_1file_1new_1for_1path_FUNC,
_1g_1file_1query_1info_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 9703843f44..e4a667fa62 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -1950,13 +1950,26 @@ public static final int /*long*/ g_data_input_stream_read_line(int /*long*/ stre
lock.unlock();
}
}
-
-//gboolean g_content_type_is_unknown (const char *type);
-///** @method flags=dynamic */
-//public static final native int /*long*/ _g_content_type_get_mime_type(int /*long*/ type);
-//public static final int /*long*/ g_content_type_get_mime_type(int /*long*/ type) {
-//
-//}
+/** @method flags=dynamic */
+public static final native boolean _g_content_type_equals(int /*long*/ type1, byte[] type2);
+public static final boolean g_content_type_equals(int /*long*/ type1, byte[] type2) {
+ lock.lock();
+ try {
+ return _g_content_type_equals(type1, type2);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
+public static final native boolean _g_content_type_is_a(int /*long*/ type, byte[] supertype);
+public static final boolean g_content_type_is_a(int /*long*/ type, byte[] supertype) {
+ lock.lock();
+ try {
+ return _g_content_type_is_a(type, supertype);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=dynamic */
public static final native int /*long*/ _g_content_type_get_mime_type(byte[] mime_type);
public static final int /*long*/ g_content_type_get_mime_type(byte[] mime_type) {
@@ -1988,6 +2001,16 @@ public static final int /*long*/ g_desktop_app_info_new_from_filename(byte[] fil
}
}
/** @method flags=dynamic */
+public static final native int /*long*/ _g_file_info_get_content_type (int /*long*/ info);
+public static final int /*long*/ g_file_info_get_content_type (int /*long*/ info) {
+ lock.lock();
+ try {
+ return g_file_info_get_content_type (info);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native int /*long*/ _g_file_get_path(int /*long*/ file);
public static final int /*long*/ g_file_get_path (int /*long*/ file) {
lock.lock();
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 56e878adf3..4160de1b98 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -263,18 +263,6 @@ JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1application_1launch)
}
#endif
-#ifndef NO__1gnome_1vfs_1mime_1can_1be_1executable
-JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1can_1be_1executable)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jboolean rc = 0;
- GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1can_1be_1executable_FUNC);
- rc = (jboolean)gnome_vfs_mime_can_be_executable((const char *)arg0);
- GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1can_1be_1executable_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gnome_1vfs_1mime_1extensions_1list_1free
JNIEXPORT void JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1extensions_1list_1free)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -339,6 +327,22 @@ fail:
}
#endif
+#ifndef NO__1gnome_1vfs_1mime_1type_1get_1equivalence
+JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1type_1get_1equivalence)
+ (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1)
+{
+ jbyte *lparg1=NULL;
+ jintLong rc = 0;
+ GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ rc = (jintLong)gnome_vfs_mime_type_get_equivalence((const char *)arg0, (const char *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
+ GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gnome_1vfs_1url_1show
JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1url_1show)
(JNIEnv *env, jclass that, jintLong arg0)
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 c3e75047c6..27d6a54825 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -38,12 +38,12 @@ char * GNOME_nativeFunctionNames[] = {
"_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs",
"_1gnome_1vfs_1mime_1application_1free",
"_1gnome_1vfs_1mime_1application_1launch",
- "_1gnome_1vfs_1mime_1can_1be_1executable",
"_1gnome_1vfs_1mime_1extensions_1list_1free",
"_1gnome_1vfs_1mime_1get_1default_1application",
"_1gnome_1vfs_1mime_1get_1extensions_1list",
"_1gnome_1vfs_1mime_1registered_1mime_1type_1list_1free",
"_1gnome_1vfs_1mime_1type_1from_1name",
+ "_1gnome_1vfs_1mime_1type_1get_1equivalence",
"_1gnome_1vfs_1url_1show",
"memmove",
};
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 a4746d2d35..eea5ffee19 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2010 IBM Corporation and others. All rights reserved.
* The contents of this file are made available under the terms
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
* accompanies this distribution (lgpl-v21.txt). The LGPL is also
@@ -46,12 +46,12 @@ typedef enum {
_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_FUNC,
_1gnome_1vfs_1mime_1application_1free_FUNC,
_1gnome_1vfs_1mime_1application_1launch_FUNC,
- _1gnome_1vfs_1mime_1can_1be_1executable_FUNC,
_1gnome_1vfs_1mime_1extensions_1list_1free_FUNC,
_1gnome_1vfs_1mime_1get_1default_1application_FUNC,
_1gnome_1vfs_1mime_1get_1extensions_1list_FUNC,
_1gnome_1vfs_1mime_1registered_1mime_1type_1list_1free_FUNC,
_1gnome_1vfs_1mime_1type_1from_1name_FUNC,
+ _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC,
_1gnome_1vfs_1url_1show_FUNC,
memmove_FUNC,
} GNOME_FUNCS;
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 2b73490029..5ff216fc97 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
@@ -25,6 +25,9 @@ public static final int GNOME_FILE_DOMAIN_PIXMAP = 4;
public static final int GNOME_ICON_LOOKUP_FLAGS_NONE = 0;
public static final int GNOME_PARAM_NONE = 0;
public static final int GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS = 0;
+public static final int GNOME_VFS_MIME_IDENTICAL = 1;
+public static final int GNOME_VFS_MIME_PARENT = 2;
+public static final int GNOME_VFS_MIME_UNRELATED = 0;
public static final int GNOME_VFS_OK = 0;
public static final int GNOME_VFS_MAKE_URI_DIR_NONE = 0;
public static final int GNOME_VFS_MAKE_URI_DIR_HOMEDIR = 1<<0;
@@ -191,16 +194,6 @@ public static final void gnome_vfs_mime_application_free(int /*long*/ applicatio
lock.unlock();
}
}
-/** @param mimeType cast=(const char *) */
-public static final native boolean _gnome_vfs_mime_can_be_executable(int /*long*/ mimeType);
-public static final boolean gnome_vfs_mime_can_be_executable(int /*long*/ mimeType) {
- lock.lock();
- try {
- return _gnome_vfs_mime_can_be_executable(mimeType);
- } finally {
- lock.unlock();
- }
-}
/** @param command_string cast=(const char *) */
public static final native boolean _gnome_vfs_is_executable_command_string(byte[] command_string);
public static final boolean gnome_vfs_is_executable_command_string(byte[] command_string) {
@@ -275,6 +268,19 @@ public static final int /*long*/ gnome_vfs_mime_type_from_name(byte[] file) {
lock.unlock();
}
}
+/**
+ * @param mime_type cast=(const char *)
+ * @param base_mime_type cast=(const char *)
+ */
+public static final native int /*long*/ _gnome_vfs_mime_type_get_equivalence(int /*long*/ mime_type, byte [] base_mime_type);
+public static final int /*long*/ gnome_vfs_mime_type_get_equivalence(int /*long*/ mime_type, byte [] base_mime_type) {
+ lock.lock();
+ try {
+ return _gnome_vfs_mime_type_get_equivalence(mime_type, base_mime_type);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @method flags=dynamic
* @param url cast=(const char *)
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 9843d8a571..9344e7bacf 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
@@ -312,6 +312,7 @@ static boolean cde_init(Display display) {
static boolean cde_isExecutable(String fileName) {
byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
return OS.access(fileNameBuffer, OS.X_OK) == 0;
+ //TODO find the content type of the file and check if it is executable
}
static String[] parseCommand(String cmd) {
@@ -564,7 +565,14 @@ static boolean gnome_isExecutable(String fileName) {
int /*long*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer);
int /*long*/ mimeType = GNOME.gnome_vfs_get_mime_type(uri);
GNOME.g_free(uri);
- return GNOME.gnome_vfs_mime_can_be_executable(mimeType);
+
+ byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$
+ boolean result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, exeType) != GNOME.GNOME_VFS_MIME_UNRELATED;
+ if (!result) {
+ byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$
+ result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, shellType) == GNOME.GNOME_VFS_MIME_IDENTICAL;
+ }
+ return result;
}
/**
@@ -904,7 +912,27 @@ static Program[] gio_getPrograms(Display display) {
static boolean gio_isExecutable(String fileName) {
byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true);
if (OS.g_file_test(fileNameBuffer, OS.G_FILE_TEST_IS_DIR)) return false;
- return OS.g_file_test(fileNameBuffer, OS.G_FILE_TEST_IS_EXECUTABLE);
+ if (!OS.g_file_test(fileNameBuffer, OS.G_FILE_TEST_IS_EXECUTABLE)) return false;
+ int /*long*/ file = OS.g_file_new_for_path (fileNameBuffer);
+ boolean result = false;
+ if (file != 0) {
+ byte[] buffer = Converter.wcsToMbcs (null, "*", true); //$NON-NLS-1$
+ int /*long*/ fileInfo = OS.g_file_query_info(file, buffer, 0, 0, 0);
+ if (fileInfo != 0) {
+ int /*long*/ contentType = OS.g_file_info_get_content_type(fileInfo);
+ if (contentType != 0) {
+ byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$
+ result = OS.g_content_type_is_a(contentType, exeType);
+ if (!result) {
+ byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$
+ result = OS.g_content_type_equals(contentType, shellType);
+ }
+ }
+ OS.g_object_unref(fileInfo);
+ }
+ OS.g_object_unref (file);
+ }
+ return result;
}
/**
@@ -970,7 +998,7 @@ static boolean isExecutable(Display display, String fileName) {
case DESKTOP_GIO: return gio_isExecutable(fileName);
case DESKTOP_GNOME_24:
case DESKTOP_GNOME: return gnome_isExecutable(fileName);
- case DESKTOP_CDE: return cde_isExecutable(fileName);
+ case DESKTOP_CDE: return false; //cde_isExecutable()
}
return false;
}
@@ -1025,7 +1053,7 @@ static boolean launch (Display display, String fileName, String workingDir) {
Compatibility.exec (new String [] {fileName}, null, workingDir);
return true;
} catch (IOException e) {
- //
+ return false;
}
}
switch (getDesktop (display)) {
@@ -1050,7 +1078,13 @@ static boolean launch (Display display, String fileName, String workingDir) {
}
break;
}
- return false;
+ /* If the above launch attempts didn't launch the file, then try with exec().*/
+ try {
+ Compatibility.exec (new String [] {fileName}, null, workingDir);
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
}
/**