org.openide.filesystems.FileUtil.wrapFileNoCanonicalize()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.openide.filesystems.FileUtil.wrapFileNoCanonicalize()方法的一些代码示例,展示了FileUtil.wrapFileNoCanonicalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.wrapFileNoCanonicalize()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:wrapFileNoCanonicalize

FileUtil.wrapFileNoCanonicalize介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private static File[] wrapFilesNoCanonicalize(File[] fs) {
  if (fs != null) {
    for (int i = 0; i < fs.length; i++) {
      fs[i] = wrapFileNoCanonicalize(fs[i]);
    }
  }
  return fs;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private static File[] wrapFilesNoCanonicalize(File[] fs) {
  if (fs != null) {
    for (int i = 0; i < fs.length; i++) {
      fs[i] = wrapFileNoCanonicalize(fs[i]);
    }
  }
  return fs;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private static File[] wrapFilesNoCanonicalize(File[] fs) {
  if (fs != null) {
    for (int i = 0; i < fs.length; i++) {
      fs[i] = wrapFileNoCanonicalize(fs[i]);
    }
  }
  return fs;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
 * Make sure that a JFileChooser does not traverse symlinks on Unix.
 * @param chooser a file chooser
 * @param currentDirectory if not null, a file to set as the current directory
 *                         using {@link JFileChooser#setCurrentDirectory} without canonicalizing
 * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=46459">Issue #46459</a>
 * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4906607">JRE bug #4906607</a>
 * @since org.openide/1 4.42
 */
public static void preventFileChooserSymlinkTraversal(JFileChooser chooser, File currentDirectory) {
  if (!(Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) {
    chooser.setCurrentDirectory(wrapFileNoCanonicalize(currentDirectory));
    chooser.setFileSystemView(new NonCanonicalizingFileSystemView());
  } else {
    chooser.setCurrentDirectory(currentDirectory);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 * Make sure that a JFileChooser does not traverse symlinks on Unix.
 * @param chooser a file chooser
 * @param currentDirectory if not null, a file to set as the current directory
 *                         using {@link JFileChooser#setCurrentDirectory} without canonicalizing
 * @see <a href="http://www.netbeans.org/issues/show_bug.cgi?id=46459">Issue #46459</a>
 * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4906607">JRE bug #4906607</a>
 * @since org.openide/1 4.42
 */
public static void preventFileChooserSymlinkTraversal(JFileChooser chooser, File currentDirectory) {
  if (!(Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) {
    chooser.setCurrentDirectory(wrapFileNoCanonicalize(currentDirectory));
    chooser.setFileSystemView(new NonCanonicalizingFileSystemView());
  } else {
    chooser.setCurrentDirectory(currentDirectory);
  }
}

相关文章