hudson.Util.deleteFile()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(165)

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

Util.deleteFile介绍

[英]Deletes this file (and does not take no for an answer). If necessary, it will have multiple attempts at deleting things.
[中]删除此文件(不接受否定回答)。如有必要,它将多次尝试删除内容。

代码示例

代码示例来源:origin: jenkinsci/jenkins

@Override
  public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(deleting(f));
    return null;
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Rename a legacy file to a new name, with care to Windows where {@link File#renameTo(File)}
 * doesn't work if the destination already exists.
 */
private void rename(File legacyFile, File newFile) throws IOException {
  if (!legacyFile.exists())   return;
  if (newFile.exists()) {
    Util.deleteFile(newFile);
  }
  if (!legacyFile.renameTo(newFile)) {
    LOGGER.warning("Failed to rename " + legacyFile + " to " + newFile);
  }
}

代码示例来源:origin: jenkinsci/jenkins

Util.deleteFile(mapFile);
System.err.println(builds + " has been restored to its original format");

代码示例来源:origin: jenkinsci/jenkins

LOGGER.log(WARNING, "need to delete anomalous file entry {0}", name);
  Util.deleteFile(kid);
  it.remove();
} catch (Exception x) {

代码示例来源:origin: jenkinsci/jenkins

Util.deleteFile(changelogFile);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(deleting(f));
    return null;
  }
});

代码示例来源:origin: org.eclipse.hudson/hudson-core

public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(f);
    return null;
  }
});

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(f);
    return null;
  }
});

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(f);
    return null;
  }
});

代码示例来源:origin: hudson/hudson-2.x

public Void invoke(File f, VirtualChannel channel) throws IOException {
    Util.deleteFile(f);
    return null;
  }
});

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Rename a legacy file to a new name, with care to Windows where {@link File#renameTo(File)}
 * doesn't work if the destination already exists.
 */
private void rename(File legacyFile, File newFile) throws IOException {
  if (!legacyFile.exists())   return;
  if (newFile.exists()) {
    Util.deleteFile(newFile);
  }
  if (!legacyFile.renameTo(newFile)) {
    LOGGER.warning("Failed to rename " + legacyFile + " to " + newFile);
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public void commit() throws IOException {
  close();
  if (destFile.exists()) {
    try {
      Util.deleteFile(destFile);
    } catch (IOException x) {
      tmpFile.delete();
      throw x;
    }
  }
  tmpFile.renameTo(destFile);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public static void deleteRecursive(File dir) throws IOException {
  if(!isSymlink(dir))
    deleteContentsRecursive(dir);
  deleteFile(dir);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public static void deleteRecursive(File dir) throws IOException {
  if (!isSymlink(dir)) {
    deleteContentsRecursive(dir);
  }
  deleteFile(dir);
}

代码示例来源:origin: hudson/hudson-2.x

public static void deleteRecursive(File dir) throws IOException {
  if(!isSymlink(dir))
    deleteContentsRecursive(dir);
  deleteFile(dir);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public static void deleteRecursive(File dir) throws IOException {
  if (!isSymlink(dir)) {
    deleteContentsRecursive(dir);
  }
  deleteFile(dir);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

Util.deleteFile(mapFile);
System.err.println(builds + " has been restored to its original format");

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private void deleteRecursive(File dir) throws IOException {
  if(!isSymlink(dir))
    deleteContentsRecursive(dir);
  try {
    deleteFile(deleting(dir));
  } catch (IOException e) {
    // if some of the child directories are big, it might take long enough to delete that
    // it allows others to create new files, causing problems like JENKINS-10113
    // so give it one more attempt before we give up.
    if(!isSymlink(dir))
      deleteContentsRecursive(dir);
    deleteFile(deleting(dir));
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

Util.deleteFile(changelogFile);

代码示例来源:origin: org.eclipse.hudson/hudson-core

public void deleteTeam(String teamName, boolean deleteJobs) throws TeamNotFoundException, IOException {
  Team team = findTeam(teamName);
  if (Team.PUBLIC_TEAM_NAME.equals(team.getName())) {
    throw new IOException("Cannot delete public team");
  }
  for (TeamJob job : team.getJobs()) {
    TopLevelItem item = Hudson.getInstance().getItem(job.getId());
    if (item != null && (item instanceof Job)) {
      if (deleteJobs) {
        try {
          item.delete();
        } catch (InterruptedException e) {
          throw new IOException("Delete team " + team.getName() + " was interrupted");
        }
      } else {
        // Make deleted team jobs public
        moveJob((Job) item, team, publicTeam, null);
      }
    }
  }
  teams.remove(team);
  save();
  File teamFolder = team.getTeamFolder(teamsFolder);
  if (teamFolder.exists() && teamFolder.isDirectory()) {
    Util.deleteContentsRecursive(teamFolder);
    Util.deleteFile(teamFolder);
  }
}

相关文章