本文整理了Java中org.openide.filesystems.FileUtil.normalizeSymLinkOnMac()
方法的一些代码示例,展示了FileUtil.normalizeSymLinkOnMac()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.normalizeSymLinkOnMac()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:normalizeSymLinkOnMac
暂无
代码示例来源:origin: org.netbeans.api/org-openide-filesystems
private static File normalizeFileOnMac(final File file) {
File retVal = file;
try {
// URI.normalize removes ../ and ./ sequences nicely.
File absoluteFile = Utilities.toFile(Utilities.toURI(file).normalize());
File canonicalFile = file.getCanonicalFile();
String absolutePath = absoluteFile.getAbsolutePath();
if (absolutePath.equals("/..")) { // NOI18N
// Special treatment.
absoluteFile = new File(absolutePath = "/"); // NOI18N
}
boolean isSymLink = !canonicalFile.getAbsolutePath().equalsIgnoreCase(absolutePath);
if (isSymLink) {
retVal = normalizeSymLinkOnMac(absoluteFile);
} else {
retVal = canonicalFile;
}
} catch (IOException ioe) {
LOG.log(Level.FINE, "Normalization failed on file " + file, ioe);
// OK, so at least try to absolutize the path
retVal = file.getAbsoluteFile();
}
return retVal;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
private static File normalizeFileOnMac(final File file) {
File retVal = file;
try {
// URI.normalize removes ../ and ./ sequences nicely.
File absoluteFile = new File(file.toURI().normalize());
File canonicalFile = file.getCanonicalFile();
boolean isSymLink = !canonicalFile.getAbsolutePath().equalsIgnoreCase(absoluteFile.getAbsolutePath());
if (isSymLink) {
retVal = normalizeSymLinkOnMac(absoluteFile);
} else {
retVal = canonicalFile;
}
} catch (IOException ioe) {
ErrorManager.getDefault().log(ErrorManager.ERROR, "Normalization failed on file " + file + ": " + ioe);
// OK, so at least try to absolutize the path
retVal = file.getAbsoluteFile();
}
return retVal;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
private static File normalizeFileOnMac(final File file) {
File retVal = file;
try {
// URI.normalize removes ../ and ./ sequences nicely.
File absoluteFile = new File(file.toURI().normalize());
File canonicalFile = file.getCanonicalFile();
boolean isSymLink = !canonicalFile.getAbsolutePath().equalsIgnoreCase(absoluteFile.getAbsolutePath());
if (isSymLink) {
retVal = normalizeSymLinkOnMac(absoluteFile);
} else {
retVal = canonicalFile;
}
} catch (IOException ioe) {
ErrorManager.getDefault().log(ErrorManager.ERROR, "Normalization failed on file " + file + ": " + ioe);
// OK, so at least try to absolutize the path
retVal = file.getAbsoluteFile();
}
return retVal;
}
内容来源于网络,如有侵权,请联系作者删除!