aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2010-01-20 14:06:51 -0500
committerSilenio Quarti2010-01-20 14:06:51 -0500
commit474c2966568dbeac4b27fdf3fd88e79d3829d960 (patch)
treea52cf7b561a3f6a654b46e58c95ea03470c480e3
parentd68971a6e0260587a83310e14c5dc867f520359b (diff)
downloadeclipse.platform.swt-474c2966568dbeac4b27fdf3fd88e79d3829d960.tar.gz
eclipse.platform.swt-474c2966568dbeac4b27fdf3fd88e79d3829d960.tar.xz
eclipse.platform.swt-474c2966568dbeac4b27fdf3fd88e79d3829d960.zip
Bug 279772 - Clicking on a batch file from within the eclipse IDE does not run it from the file location
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java74
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java68
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java34
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java54
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java20
22 files changed, 443 insertions, 31 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 a08fc415ce..f4a463a787 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
@@ -2276,6 +2276,22 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1XWarpPointer)
}
#endif
+#ifndef NO__1access
+JNIEXPORT jint JNICALL OS_NATIVE(_1access)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
+{
+ jbyte *lparg0=NULL;
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1access_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ rc = (jint)access((const char*)lparg0, arg1);
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1access_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1atk_1object_1add_1relationship
JNIEXPORT jboolean JNICALL OS_NATIVE(_1atk_1object_1add_1relationship)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLong arg2)
@@ -2879,6 +2895,30 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1read)
}
#endif
+#ifndef NO__1g_1file_1test
+JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1file_1test)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
+{
+ jbyte *lparg0=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1file_1test_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+/*
+ rc = (jboolean)g_file_test(lparg0, arg1);
+*/
+ {
+ LOAD_FUNCTION(fp, g_file_test)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jbyte *, jint))fp)(lparg0, arg1);
+ }
+ }
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1g_1file_1test_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1filename_1from_1uri
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1filename_1from_1uri)
(JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintLongArray arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index e930b9b1c3..86758b5042 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -31,6 +31,7 @@
#include <string.h>
#include <dlfcn.h>
#include <locale.h>
+#include <unistd.h>
#ifndef GDK_WINDOWING_X11
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 e26b635206..4099c5869a 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
@@ -239,6 +239,7 @@
#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"
+#define g_file_test_LIB "libgio-2.0.so.0"
#define g_icon_to_string_LIB "libgio-2.0.so.0"
#define g_icon_new_for_string_LIB "libgio-2.0.so.0"
#define g_file_query_info_LIB "libgio-2.0.so.0"
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 c7d782a235..aed702c964 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
@@ -213,6 +213,7 @@ typedef enum {
_1XTestFakeKeyEvent_FUNC,
_1XTestFakeMotionEvent_FUNC,
_1XWarpPointer_FUNC,
+ _1access_FUNC,
_1atk_1object_1add_1relationship_FUNC,
_1call_FUNC,
_1dlclose_FUNC,
@@ -244,6 +245,7 @@ typedef enum {
_1g_1file_1new_1for_1path_FUNC,
_1g_1file_1query_1info_FUNC,
_1g_1file_1read_FUNC,
+ _1g_1file_1test_FUNC,
_1g_1filename_1from_1uri_FUNC,
_1g_1filename_1from_1utf8_FUNC,
_1g_1filename_1to_1uri_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 507e24b14e..c061d25f7b 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
@@ -40,6 +40,8 @@ public class OS extends C {
/** Constants */
public static final int /*long*/ AnyPropertyType = 0;
public static final int ATK_RELATION_LABELLED_BY = 4;
+ public static final int G_FILE_TEST_IS_DIR = 1 << 2;
+ public static final int G_FILE_TEST_IS_EXECUTABLE = 1 << 3;
public static final int G_SIGNAL_MATCH_DATA = 1 << 4;
public static final int G_SIGNAL_MATCH_ID = 1 << 0;
public static final int GDK_2BUTTON_PRESS = 0x5;
@@ -422,6 +424,7 @@ public class OS extends C {
public static final int RTLD_GLOBAL = 0x100;
public static final int RTLD_LAZY = 1;
public static final int RTLD_NOW = 2;
+ public static final int X_OK = 0x01;
public static final int XA_CARDINAL = 6;
public static final int XA_WINDOW = 33;
@@ -2055,6 +2058,16 @@ public static final int /*long*/ g_file_read(int /*long*/ file, int /*long*/ can
}
}
/** @method flags=dynamic */
+public static final native boolean /*long*/ _g_file_test(byte[] file, int test);
+public static final boolean /*long*/ g_file_test(byte[] file, int test) {
+ lock.lock();
+ try {
+ return _g_file_test(file, test);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
public static final native int /*long*/ _g_icon_to_string(int /*long*/ icon);
public static final int /*long*/ g_icon_to_string (int /*long*/ icon) {
lock.lock();
@@ -14840,4 +14853,17 @@ public static final boolean atk_object_add_relationship (int /*long*/ object, in
lock.unlock();
}
}
+/**
+ * @param path cast=(const char*)
+ */
+public static final native int _access (byte [] path, int amode);
+public static final int access (byte [] path, int amode) {
+ lock.lock();
+ try {
+ return _access(path, amode);
+ } finally {
+ lock.unlock();
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
index 8e5d93c0a7..ae0bb25138 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -5474,6 +5474,22 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1_1XtDefaultAppContext)
}
#endif
+#ifndef NO__1access
+JNIEXPORT jint JNICALL OS_NATIVE(_1access)
+ (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
+{
+ jbyte *lparg0=NULL;
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1access_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ rc = (jint)access((const char*)lparg0, arg1);
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1access_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1applicationShellWidgetClass
JNIEXPORT jint JNICALL OS_NATIVE(_1applicationShellWidgetClass)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
index f7022ddc1d..288b3c99f5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 466;
-int OS_nativeFunctionCallCount[466];
+int OS_nativeFunctionCount = 467;
+int OS_nativeFunctionCallCount[467];
char * OS_nativeFunctionNames[] = {
"CODESET",
"FD_1ISSET",
@@ -423,6 +423,7 @@ char * OS_nativeFunctionNames[] = {
"_1XtWindowToWidget",
"_1_1XmSetMenuTraversal",
"_1_1XtDefaultAppContext",
+ "_1access",
"_1applicationShellWidgetClass",
"_1dlclose",
"_1dlopen",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
index 251ed945a6..4aeae2a6d1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -431,6 +431,7 @@ typedef enum {
_1XtWindowToWidget_FUNC,
_1_1XmSetMenuTraversal_FUNC,
_1_1XtDefaultAppContext_FUNC,
+ _1access_FUNC,
_1applicationShellWidgetClass_FUNC,
_1dlclose_FUNC,
_1dlopen_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
index e4a78b2322..2d359b9505 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java
@@ -181,6 +181,7 @@ public class OS extends C {
public static final int SunXK_F37 = 0x1005FF11;
public static final int UnmapNotify = 18;
public static final int Unsorted = 0x0;
+ public static final int X_OK = 0x01;
public static final int XA_ATOM = 4;
public static final int XA_FONT = 18;
public static final int XBufferOverflow = 0xFFFFFFFF;
@@ -827,6 +828,18 @@ public static final native void FD_ZERO(byte[] fd_set);
public static final native int LC_CTYPE();
/** @method flags=const */
public static final native int MB_CUR_MAX();
+/**
+ * @param path cast=(const char*)
+ */
+public static final native int _access (byte [] path, int amode);
+public static final int access (byte [] path, int amode) {
+ lock.lock();
+ try {
+ return _access(path, amode);
+ } finally {
+ lock.unlock();
+ }
+}
/** @method flags=const */
public static final native int _applicationShellWidgetClass();
public static final int applicationShellWidgetClass() {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
index 8b8385faff..270a03ead7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11684,6 +11684,18 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(PatBlt)
}
#endif
+#ifndef NO_PathIsExe
+JNIEXPORT jboolean JNICALL OS_NATIVE(PathIsExe)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, PathIsExe_FUNC);
+ rc = (jboolean)PathIsExe((LPCWSTR)arg0);
+ OS_NATIVE_EXIT(env, that, PathIsExe_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_PeekMessageA
JNIEXPORT jboolean JNICALL OS_NATIVE(PeekMessageA)
(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jint arg2, jint arg3, jint arg4)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
index 32a6781eac..8da2f4bb10 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 984;
-int OS_nativeFunctionCallCount[984];
+int OS_nativeFunctionCount = 985;
+int OS_nativeFunctionCallCount[985];
char * OS_nativeFunctionNames[] = {
"ACCEL_1sizeof",
"ACTCTX_1sizeof",
@@ -1167,6 +1167,7 @@ char * OS_nativeFunctionNames[] = {
"PRINTDLG_1sizeof",
"PROCESS_1INFORMATION_1sizeof",
"PatBlt",
+ "PathIsExe",
"PeekMessageA",
"PeekMessageW",
"Pie",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
index e00bae8496..8ad701cc51 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1175,6 +1175,7 @@ typedef enum {
PRINTDLG_1sizeof_FUNC,
PROCESS_1INFORMATION_1sizeof_FUNC,
PatBlt_FUNC,
+ PathIsExe_FUNC,
PeekMessageA_FUNC,
PeekMessageW_FUNC,
Pie_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index b174dcbc29..4d6a77a096 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -5447,6 +5447,8 @@ public static final native boolean OpenClipboard (int /*long*/ hWndNewOwner);
public static final native int /*long*/ OpenThemeData (int /*long*/ hwnd, char[] pszClassList);
/** @param hdc cast=(HDC) */
public static final native boolean PatBlt (int /*long*/ hdc, int x1, int x2, int w, int h, int rop);
+/** @param szfile cast=(LPCWSTR) */
+public static final native boolean PathIsExe (int /*long*/ szfile);
/** @param hWnd cast=(HWND) */
public static final native boolean PeekMessageW (MSG lpMsg, int /*long*/ hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);
/** @param hWnd cast=(HWND) */
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 c74ea719a6..56e878adf3 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, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2009 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
@@ -141,6 +141,18 @@ JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1icon_1theme_1new)
}
#endif
+#ifndef NO__1gnome_1vfs_1get_1mime_1type
+JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1get_1mime_1type)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1get_1mime_1type_FUNC);
+ rc = (jintLong)gnome_vfs_get_mime_type((const char *)arg0);
+ GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1get_1mime_1type_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gnome_1vfs_1get_1registered_1mime_1types
JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1get_1registered_1mime_1types)
(JNIEnv *env, jclass that)
@@ -165,6 +177,22 @@ JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1init)
}
#endif
+#ifndef NO__1gnome_1vfs_1is_1executable_1command_1string
+JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1is_1executable_1command_1string)
+ (JNIEnv *env, jclass that, jbyteArray arg0)
+{
+ jbyte *lparg0=NULL;
+ jboolean rc = 0;
+ GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1is_1executable_1command_1string_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ rc = (jboolean)gnome_vfs_is_executable_command_string((const char *)lparg0);
+fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1is_1executable_1command_1string_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gnome_1vfs_1make_1uri_1from_1input
JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input)
(JNIEnv *env, jclass that, jbyteArray arg0)
@@ -235,6 +263,18 @@ 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)
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 e541d8ef5d..c3e75047c6 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, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2009 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
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int GNOME_nativeFunctionCount = 22;
-int GNOME_nativeFunctionCallCount[22];
+int GNOME_nativeFunctionCount = 25;
+int GNOME_nativeFunctionCallCount[25];
char * GNOME_nativeFunctionNames[] = {
"GnomeVFSMimeApplication_1sizeof",
"_1g_1free",
@@ -30,12 +30,15 @@ char * GNOME_nativeFunctionNames[] = {
"_1gnome_1icon_1lookup",
"_1gnome_1icon_1theme_1lookup_1icon",
"_1gnome_1icon_1theme_1new",
+ "_1gnome_1vfs_1get_1mime_1type",
"_1gnome_1vfs_1get_1registered_1mime_1types",
"_1gnome_1vfs_1init",
+ "_1gnome_1vfs_1is_1executable_1command_1string",
"_1gnome_1vfs_1make_1uri_1from_1input",
"_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",
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 8aea1d9165..a4746d2d35 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, 2008 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2009 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,15 @@ typedef enum {
_1gnome_1icon_1lookup_FUNC,
_1gnome_1icon_1theme_1lookup_1icon_FUNC,
_1gnome_1icon_1theme_1new_FUNC,
+ _1gnome_1vfs_1get_1mime_1type_FUNC,
_1gnome_1vfs_1get_1registered_1mime_1types_FUNC,
_1gnome_1vfs_1init_FUNC,
+ _1gnome_1vfs_1is_1executable_1command_1string_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,
+ _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,
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 9802b71f9e..2b73490029 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
@@ -138,6 +138,17 @@ public static final int /*long*/ gnome_vfs_get_registered_mime_types() {
lock.unlock();
}
}
+/** @param uri cast=(const char *) */
+public static final native int /*long*/ _gnome_vfs_get_mime_type(int /*long*/ uri);
+public static final int /*long*/ gnome_vfs_get_mime_type(int /*long*/ uri) {
+ lock.lock();
+ try {
+ return _gnome_vfs_get_mime_type(uri);
+ } finally {
+ lock.unlock();
+ }
+}
+
public static final native boolean _gnome_vfs_init();
public static final boolean gnome_vfs_init() {
lock.lock();
@@ -180,6 +191,26 @@ 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) {
+ lock.lock();
+ try {
+ return _gnome_vfs_is_executable_command_string(command_string);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @method flags=dynamic
* @param application cast=(GnomeVFSMimeApplication *)
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 399b810064..f3ec93417f 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
@@ -309,6 +309,11 @@ static boolean cde_init(Display display) {
return initOK;
}
+static boolean cde_isExecutable(String fileName) {
+ byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
+ return OS.access(fileNameBuffer, OS.X_OK) == 0;
+}
+
static String[] parseCommand(String cmd) {
Vector args = new Vector();
int sIndex = 0;
@@ -550,6 +555,18 @@ static boolean gnome_init() {
}
}
+static boolean gnome_isExecutable(String fileName) {
+ /* check if the file is executable */
+ byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
+ if (!GNOME.gnome_vfs_is_executable_command_string(fileNameBuffer)) return false;
+
+ /* check if the mime type is executable */
+ 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);
+}
+
/**
* Finds the program that is associated with an extension.
* The extension may or may not begin with a '.'. Note that
@@ -878,6 +895,12 @@ static Program[] gio_getPrograms(Display display) {
return programList;
}
+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);
+}
+
/**
* GNOME 2.4 - Launch the default program for the given file.
*/
@@ -936,6 +959,16 @@ static String[] gio_getExtensions() {
return extStrings;
}
+public static boolean isExecutable(Display display, String fileName) {
+ switch(getDesktop(display)) {
+ 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);
+ }
+ return false;
+}
+
/**
* Launches the operating system executable associated with the file or
* URL (http:// or https://). If the file is an executable then the
@@ -950,15 +983,45 @@ static String[] gio_getExtensions() {
* </ul>
*/
public static boolean launch(String fileName) {
- return launch(Display.getCurrent(), fileName);
+ return launch(Display.getCurrent(), fileName, null);
+}
+
+/**
+* Launches the operating system executable associated with the file or
+* URL (http:// or https://). If the file is an executable then the
+* executable is launched. If a valid working directory is specified
+* it is used as the working directory for the launched program.
+* Note that a <code>Display</code> must already exist to guarantee
+* that this method returns an appropriate result.
+*
+* @param fileName the file or program name or URL (http:// or https://)
+* @param workingDirectory the name of the working directory or null
+* @return <code>true</code> if the file is launched, otherwise <code>false</code>
+*
+* @exception IllegalArgumentException <ul>
+* <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+* </ul>
+*
+* @since 3.6
+*/
+/*public*/ static boolean launch (String fileName, String workingDir) {
+ return launch(Display.getCurrent(), fileName, workingDir);
}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
-static boolean launch (Display display, String fileName) {
+static boolean launch (Display display, String fileName, String workingDir) {
if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (isExecutable(display, fileName)) {
+ try {
+ Compatibility.exec (new String [] {fileName}, null, workingDir);
+ return true;
+ } catch (IOException e) {
+ //
+ }
+ }
switch (getDesktop (display)) {
case DESKTOP_GIO:
if (gio_launch (fileName)) return true;
@@ -981,12 +1044,7 @@ static boolean launch (Display display, String fileName) {
}
break;
}
- try {
- Compatibility.exec (fileName);
- return true;
- } catch (IOException e) {
- return false;
- }
+ return false;
}
/**
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 38bfd903f5..6d26bd1f98 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
@@ -160,6 +160,11 @@ boolean cde_execute(String fileName) {
return actionID != 0;
}
+static boolean cde_isExecutable(String fileName) {
+ byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
+ return OS.access(fileNameBuffer, OS.X_OK) == 0;
+}
+
static String cde_getAction(String dataType) {
String action = null;
String actions = cde_getAttribute(dataType, CDE.DtDTS_DA_ACTION_LIST);
@@ -569,6 +574,18 @@ static boolean gnome_init() {
}
}
+static boolean gnome_isExecutable(String fileName) {
+ /* check if the file is executable */
+ byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
+ if (!GNOME.gnome_vfs_is_executable_command_string(fileNameBuffer)) return false;
+
+ /* check if the mime type is executable */
+ 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);
+}
+
/**
* Finds the program that is associated with an extension.
* The extension may or may not begin with a '.'. Note that
@@ -699,6 +716,15 @@ static Program[] getPrograms(Display display) {
return programList;
}
+static boolean isExecutable(Display display, String fileName) {
+ switch(getDesktop(display)) {
+ case DESKTOP_GNOME_24:
+ case DESKTOP_GNOME: return gnome_isExecutable(fileName);
+ case DESKTOP_CDE: return cde_isExecutable(fileName);
+ }
+ return false;
+}
+
/**
* Launches the operating system executable associated with the file or
* URL (http:// or https://). If the file is an executable then the
@@ -713,15 +739,46 @@ static Program[] getPrograms(Display display) {
* </ul>
*/
public static boolean launch(String fileName) {
- return launch(Display.getCurrent(), fileName);
+ return launch(Display.getCurrent(), fileName, null);
}
+/**
+* Launches the operating system executable associated with the file or
+* URL (http:// or https://). If the file is an executable then the
+* executable is launched. If a valid working directory is specified
+* it is used as the working directory for the launched program.
+* Note that a <code>Display</code> must already exist to guarantee
+* that this method returns an appropriate result.
+*
+* @param fileName the file or program name or URL (http:// or https://)
+* @param workingDirectory the name of the working directory or null
+* @return <code>true</code> if the file is launched, otherwise <code>false</code>
+*
+* @exception IllegalArgumentException <ul>
+* <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+* <li>ERROR_INVALID_ARGUMENT when workingDirectory is not valid</li>
+* </ul>
+*
+* @since 3.6
+*/
+public static boolean launch (String fileName, String workingDir) {
+ return launch(Display.getCurrent(), fileName, workingDir);
+}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
-static boolean launch (Display display, String fileName) {
+static boolean launch (Display display, String fileName, String workingDir) {
if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+
+ if (isExecutable(display, fileName)) {
+ try {
+ Compatibility.exec (new String [] {fileName}, null, workingDir);
+ return true;
+ } catch (IOException e) {
+ //
+ }
+ }
switch (getDesktop (display)) {
case DESKTOP_GNOME_24:
if (gnome_24_launch (fileName)) return true;
@@ -742,12 +799,7 @@ static boolean launch (Display display, String fileName) {
}
break;
}
- try {
- Compatibility.exec (fileName);
- return true;
- } catch (IOException e) {
- return false;
- }
+ return false;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
index 9cc4031f58..ad1d5cdd72 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
@@ -263,6 +263,29 @@ public static Program [] getPrograms () {
* </ul>
*/
public static boolean launch (String fileName) {
+ return launch(fileName, null);
+}
+
+/**
+ * Launches the operating system executable associated with the file or
+ * URL (http:// or https://). If the file is an executable then the
+ * executable is launched. If a valid working directory is specified
+ * it is used as the working directory for the launched program.
+ * Note that a <code>Display</code> must already exist to guarantee
+ * that this method returns an appropriate result.
+ *
+ * @param fileName the file or program name or URL (http:// or https://)
+ * @param workingDirectory the name of the working directory or null
+ * @return <code>true</code> if the file is launched, otherwise <code>false</code>
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT when fileName is null</li>
+ * <li>ERROR_INVALID_ARGUMENT when workingDirectory is not valid</li>
+ * </ul>
+ *
+ * @since 3.6
+ */
+/*public*/ static boolean launch (String fileName, String workingDirectory) {
if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
/* Use the character encoding for the default locale */
@@ -271,12 +294,23 @@ public static boolean launch (String fileName) {
int byteCount = buffer.length () * TCHAR.sizeof;
int /*long*/ lpFile = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (lpFile, buffer, byteCount);
+
+ int /*long*/ lpDirectory = 0;
+ if (workingDirectory != null && OS.PathIsExe(lpFile)) {
+ TCHAR buffer1 = new TCHAR (0, workingDirectory, true);
+ byteCount = buffer1.length () * TCHAR.sizeof;
+ lpDirectory = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ OS.MoveMemory (lpDirectory, buffer1, byteCount);
+ }
+
SHELLEXECUTEINFO info = new SHELLEXECUTEINFO ();
info.cbSize = SHELLEXECUTEINFO.sizeof;
info.lpFile = lpFile;
+ info.lpDirectory = lpDirectory;
info.nShow = OS.SW_SHOW;
boolean result = OS.ShellExecuteEx (info);
if (lpFile != 0) OS.HeapFree (hHeap, 0, lpFile);
+ if (lpDirectory != 0) OS.HeapFree (hHeap, 0, lpDirectory);
return result;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java
index 94becf9755..b31a66cefa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatibility.java
@@ -327,6 +327,60 @@ public static void exec(String[] progArray) throws java.io.IOException{
}
/**
+ * Execute progArray[0] in a separate platform process with the specified
+ * environment and working directory if the underlying platform support
+ * this.
+ * <p>
+ * If envp is null the new process inherits the environment of the caller.
+ * <p>
+ *
+ * @param progArray
+ * array containing the program to execute and its arguments
+ * @param envp
+ * array of strings, each element of which has environment
+ * variable settings in format name=value.
+ * @param dir
+ * the working directory of the new process, or null if the new
+ * process should inherit the working directory of the caller.
+ *
+ * @exception IOException
+ * if the program cannot be executed
+ * @exception SecurityException
+ * if the current SecurityManager disallows program execution
+ *
+ * @since 3.6
+ */
+public static void exec(String[] prog, String[] envp, String workingDir) throws java.io.IOException{
+ throw new IOException();
+}
+
+/**
+ * Execute progArray[0] in a separate platform process with the specified
+ * environment and working directory if the underlying platform support
+ * this.
+ * <p>
+ * If envp is null the new process inherits the environment of the caller.
+ * <p>
+ *
+ * @param progArray
+ * array containing the program to execute and its arguments
+ * @param envp
+ * array of strings, each element of which has environment
+ * variable settings in format name=value.
+ * @param dir
+ * the working directory of the new process, or null if the new
+ * process should inherit the working directory of the caller.
+ *
+ * @exception IOException
+ * if the program cannot be executed
+ * @exception SecurityException
+ * if the current SecurityManager disallows program execution
+ */
+public static void exec(String[] prog, String[] envp, String workingDir) throws java.io.IOException{
+ throw new IOException();
+}
+
+/**
* Returns the NLS'ed message for the given argument. This is only being
* called from SWT.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
index 13e2a65066..7f7ca9d6ff 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatibility.java
@@ -282,6 +282,26 @@ public static void exec(String[] progArray) throws java.io.IOException{
Runtime.getRuntime().exec(progArray);
}
+/**
+ * Execute prog in a separate platform process if the
+ * underlying platform support this.
+ * <p>
+ * The new process inherits the environment of the caller.
+ * <p>
+ *
+ * @param prog containing the program to execute and its arguments
+ *
+ * @exception IOException
+ * if the program cannot be executed
+ * @exception SecurityException
+ * if the current SecurityManager disallows program execution
+ *
+ * @since 3.6
+ */
+public static void exec(String[] prog, String[] envp, String workingDir) throws java.io.IOException{
+ Runtime.getRuntime().exec(prog, null, workingDir != null ? new File(workingDir) : null);
+}
+
private static ResourceBundle msgs = null;
/**