当前位置: 首页>>代码示例>>Java>>正文


Java FileUtilRt.copy方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt.copy方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt.copy方法的具体用法?Java FileUtilRt.copy怎么用?Java FileUtilRt.copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.io.FileUtilRt的用法示例。


在下文中一共展示了FileUtilRt.copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTempExecutable

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static File createTempExecutable(File executable) throws IOException {
  File executableDir = new File(System.getProperty("user.home") + "/." + System.getProperty("idea.paths.selector") + "/restart");
  if (!FileUtilRt.createDirectory(executableDir)) throw new IOException("Cannot create dir: " + executableDir);
  File copy = new File(executableDir.getPath() + "/" + executable.getName());
  if (!FileUtilRt.ensureCanCreateFile(copy) || (copy.exists() && !copy.delete())) {
     String ext = FileUtilRt.getExtension(executable.getName());
     copy = FileUtilRt.createTempFile(executableDir, FileUtilRt.getNameWithoutExtension(copy.getName()),
                                      StringUtil.isEmptyOrSpaces(ext) ? ".tmp" : ("." + ext),
                                      true, false);
  }
  FileUtilRt.copy(executable, copy);
  if (!copy.setExecutable(executable.canExecute())) throw new IOException("Cannot make file executable: " + copy);
  return copy;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:Restarter.java

示例2: copyFile

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static void copyFile(File original, File copy, boolean move) throws IOException {
  if (move) {
    if (!original.renameTo(copy) || !FileUtilRt.delete(original)) {
      throw new IOException("Cannot create temporary file: " + copy);
    }
  }
  else {
    FileUtilRt.copy(original, copy);
    if (!copy.exists()) {
      throw new IOException("Cannot create temporary file: " + copy);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:Main.java

示例3: execute

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public void execute() throws IOException {
  // create dirs for destination
  File parentFile = myDestination.getParentFile();
  if (! parentFile.exists())
    if (! myDestination.getParentFile().mkdirs()) {
      JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
                                    MessageFormat.format("<html>Cannot create parent directory [{0}] of {1}<br>Please, check your access rights on folder <br>{2}",
                                    parentFile.getAbsolutePath(), myDestination.getAbsolutePath(), parentFile.getParent()),
                                    "Installing Plugin",
                                    JOptionPane.ERROR_MESSAGE);
    }

  if (!mySource.exists()) {
    // NOTE: Please don't use LOG.error here - this will block IDEA startup in case of problems with plugin installation (IDEA-54045)

    //noinspection HardCodedStringLiteral,UseOfSystemOutOrSystemErr
    System.err.println("Source file " + mySource.getAbsolutePath() + " does not exist for action " + this);
  }
  else if (!canCreateFile(myDestination)) {
    JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),
                                  MessageFormat.format("<html>Cannot copy {0}<br>to<br>{1}<br>Please, check your access rights on folder <br>{2}",
                                                       mySource.getAbsolutePath(),  myDestination.getAbsolutePath(), myDestination.getParent()),
                                  "Installing Plugin", JOptionPane.ERROR_MESSAGE);
  }
  else {
    FileUtilRt.copy(mySource, myDestination);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:StartupActionScriptManager.java


注:本文中的com.intellij.openapi.util.io.FileUtilRt.copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。