summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2006-09-12 22:23:52 +0000
committerSilenio Quarti <silenio>2006-09-12 22:23:52 +0000
commitb342ee5d6aad586106f7626c54ef8e5fbeb06deb (patch)
tree6b2258a159cfbe590592abd22d536c473d464f27 /bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java
parent8c17c0dc0cfa02ca9270578b50ada2ac195f1744 (diff)
downloadeclipse.platform.swt-b342ee5d6aad586106f7626c54ef8e5fbeb06deb.tar.gz
eclipse.platform.swt-b342ee5d6aad586106f7626c54ef8e5fbeb06deb.tar.xz
eclipse.platform.swt-b342ee5d6aad586106f7626c54ef8e5fbeb06deb.zip
execute app with empty fileName
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java42
1 files changed, 23 insertions, 19 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java
index abeb54e364..3e4da5c26e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/carbon/org/eclipse/swt/program/Program.java
@@ -390,28 +390,32 @@ public boolean execute (String fileName) {
if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (OS.VERSION < 0x1040) return launch(fileName);
int rc = -1;
- char[] chars = new char[fileName.length()];
- fileName.getChars(0, chars.length, chars, 0);
- int arg = OS.CFStringCreateWithCharacters(0, chars, chars.length);
- if (arg != 0) {
- int url = OS.CFURLCreateWithFileSystemPath(OS.kCFAllocatorDefault, arg, OS.kCFURLPOSIXPathStyle, false);
- if (url != 0) {
- byte[] itemRef = new byte[80];
- if (OS.CFURLGetFSRef(url, itemRef)) {
- int fsRefPtr = OS.NewPtr(fsRef.length);
- if (fsRefPtr != 0) {
- OS.memcpy(fsRefPtr, fsRef, fsRef.length);
- LSApplicationParameters params = new LSApplicationParameters();
- params.version = 0;
- params.flags = 0;
- params.application = fsRefPtr;
- rc = OS.LSOpenItemsWithRole(itemRef, 1, OS.kLSRolesAll, 0, params, null, 0);
- OS.DisposePtr(fsRefPtr);
+ int fsRefPtr = OS.NewPtr(fsRef.length);
+ if (fsRefPtr != 0) {
+ OS.memcpy(fsRefPtr, fsRef, fsRef.length);
+ LSApplicationParameters params = new LSApplicationParameters();
+ params.version = 0;
+ params.flags = 0;
+ params.application = fsRefPtr;
+ if (fileName.length() == 0) {
+ rc = OS.LSOpenApplication(params, null);
+ } else {
+ char[] chars = new char[fileName.length()];
+ fileName.getChars(0, chars.length, chars, 0);
+ int arg = OS.CFStringCreateWithCharacters(0, chars, chars.length);
+ if (arg != 0) {
+ int url = OS.CFURLCreateWithFileSystemPath(OS.kCFAllocatorDefault, arg, OS.kCFURLPOSIXPathStyle, false);
+ if (url != 0) {
+ byte[] itemRef = new byte[80];
+ if (OS.CFURLGetFSRef(url, itemRef)) {
+ rc = OS.LSOpenItemsWithRole(itemRef, 1, OS.kLSRolesAll, 0, params, null, 0);
+ }
+ OS.CFRelease(url);
}
+ OS.CFRelease(arg);
}
- OS.CFRelease(url);
}
- OS.CFRelease(arg);
+ OS.DisposePtr(fsRefPtr);
}
return rc == OS.noErr;
}