use of org.eclipse.core.filesystem.provider.FileInfo in project che by eclipse.
the class LocalFile method fetchInfo.
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) {
// if (LocalFileNativesManager.isUsingNatives()) {
// FileInfo info = LocalFileNativesManager.fetchFileInfo(filePath);
// //natives don't set the file name on all platforms
// if (info.getName().length() == 0) {
// String name = file.getName();
// //Bug 294429: make sure that substring baggage is removed
// info.setName(new String(name.toCharArray()));
// }
// return info;
// }
//in-lined non-native implementation
FileInfo info = new FileInfo(file.getName());
final long lastModified = file.lastModified();
if (lastModified <= 0) {
//if the file doesn't exist, all other attributes should be default values
info.setExists(false);
return info;
}
info.setLastModified(lastModified);
info.setExists(true);
info.setLength(file.length());
info.setDirectory(file.isDirectory());
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, file.exists() && !file.canWrite());
info.setAttribute(EFS.ATTRIBUTE_HIDDEN, file.isHidden());
return info;
}