/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
private static final boolean DEBUG = false;
// Constants from LaunchServices.h
static final int kLSItemInfoAppPrefersNative = 0x00000200; /* Carbon app that prefers to be launched natively*/
static final int kLSItemInfoAppPrefersClassic = 0x00000400; /* Carbon app that prefers to be launched in Classic*/
static {
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
}
// TODO: Un-comment this out when the native version exists
//private static native String getNativePathToRunningJDKBundle();
private static native String getNativeDisplayName(final byte[] pathBytes, final boolean isDirectory);
private static native String getNativePathForResolvedAlias(final byte[] absolutePath, final boolean isDirectory);
protected String getInstance() {
return getNativeMachineName();
}
};
return machineName.get();
}
// TODO: Return empty string for now
return "";//getNativePathToRunningJDKBundle();
}
return getNativePathToSharedJDKBundle();
}
static class FileInfo {
final boolean isDirectory;
byte[] pathBytes;
try {
} catch (final UnsupportedEncodingException e) {
pathBytes = new byte[0];
}
}
}
return size() > MAX_CACHED_ENTRIES;
}
};
return newInfo;
}
}
}
return fFileChooserUI.fileDescriptionText;
}
boolean _packageIsTraversable() {
}
boolean _applicationIsTraversable() {
}
if (nativeDisplayName != null) {
return nativeDisplayName;
}
return localMachineName;
}
return displayName;
}
return f.getName();
}
if (f.isDirectory()) return _directoryDescriptionText();
return _fileDescriptionText();
}
if (f == null) {
} else {
// Look for the document's icon
if (!fileIcon.hasIconRef()) {
// Fall back on the default icons
if (f.isDirectory()) {
} else {
}
} else {
}
}
}
}
// aliases are traversable though they aren't directories
if (f.isDirectory()) {
// Doesn't matter if it's a package or app, because they're traversable
if (_packageIsTraversable() && _applicationIsTraversable()) {
} else if (!_packageIsTraversable() && !_applicationIsTraversable()) {
} else if (!_applicationIsTraversable()) {
} else if (!_packageIsTraversable()) {
// [3101730] All applications are packages, but not all packages are applications.
}
// We're allowed to traverse it
}
if (isAlias(f)) {
}
}
}
return info.launchServicesInfo;
}
final int lsInfo = getLSInfoFor(f);
}
}
}
/**
* Things that need to be handled:
* -Change getFSRef to use CFURLRef instead of FSPathMakeRef
* -Use the HFS-style path from CFURLRef in resolveAlias() to avoid
* path length limitations
* -In resolveAlias(), simply resolve immediately if this is an alias
*/
/**
* Returns the actual file represented by this object. This will
* resolve any aliases in the path, including this file if it is an
* alias. No alias resolution requiring user interaction (e.g.
* mounting servers) will occur. Note that aliases to servers may
* take a significant amount of time to resolve. This method
* currently does not have any provisions for a more fine-grained
* timeout for alias resolution beyond that used by the system.
*
* In the event of a path that does not contain any aliases, or if the file
* does not exist, this method will return the file that was passed in.
* @return The canonical path to the file
* @throws IOException If an I/O error occurs while attempting to
* construct the path
*/
// If the file exists and is not an alias, there aren't
// any aliases along its path, so the standard version
// of getCanonicalPath() will work.
return mFile;
}
// If it doesn't exist, either there's an alias in the
// path or this is an alias. Traverse the path and
// resolve all aliases in it.
if (components == null) {
return mFile;
}
// If any point along the way doesn't exist,
// just return the file.
// Resolve it!
// <rdar://problem/3582601> If the alias doesn't resolve (on a non-existent volume, for example)
// just return the file.
}
}
return file;
}
/**
* Returns a linked list of Strings consisting of the components of
* the path of this file, in order, including the filename as the
* last element. The first element in the list will be the first
* directory in the path, or "".
* @return A linked list of the components of this file's path
*/
}
return componentList;
}
}