static boolean isExecutable(String fileName) { long /*int*/ ptr = OS.malloc(1); NSString path = NSString.stringWith(fileName); boolean result = false; NSFileManager manager = NSFileManager.defaultManager(); if (manager.fileExistsAtPath(path, ptr)) { byte[] isDirectory = new byte[1]; OS.memmove(isDirectory, ptr, 1); if (isDirectory[0] == 0 && manager.isExecutableFileAtPath(path)) { NSWorkspace ws = NSWorkspace.sharedWorkspace(); NSString type = ws.typeOfFile(path, 0); result = type != null && (ws.type(type, NSString.stringWith("public.unix-executable")) || //$NON-NLS-1$ OS.UTTypeEqual( type.id, NSString.stringWith("public.shell-script").id)); // $NON-NLS-1$ } } OS.free(ptr); return result; }