本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.asyncDelete方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.asyncDelete方法的具体用法?Java FileUtil.asyncDelete怎么用?Java FileUtil.asyncDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.asyncDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreFromUndoStorage
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void restoreFromUndoStorage(final File dst) {
String normPath = FileUtil.toSystemIndependentName(dst.getPath());
for (Iterator<Couple<File>> it = myUndoStorageContents.iterator(); it.hasNext();) {
Couple<File> e = it.next();
final String p = FileUtil.toSystemIndependentName(e.first.getPath());
if (p.startsWith(normPath)) {
try {
FileUtil.rename(e.second, e.first);
}
catch (IOException ex) {
LOG.error(ex);
FileUtil.asyncDelete(e.second);
}
it.remove();
}
}
if (myStorageForUndo != null) {
final File[] files = myStorageForUndo.listFiles();
if (files == null || files.length == 0) {
FileUtil.asyncDelete(myStorageForUndo);
myStorageForUndo = null;
}
}
}
示例2: tearDown
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (myTempDir != null) {
FileUtil.asyncDelete(myTempDir);
}
Disposer.dispose(myRootDisposable);
}
示例3: deletePycFiles
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public static void deletePycFiles(String pyFilePath) {
if (pyFilePath.endsWith(".py")) {
List<File> filesToDelete = new ArrayList<File>();
File pyc = new File(pyFilePath + "c");
if (pyc.exists()) {
filesToDelete.add(pyc);
}
File pyo = new File(pyFilePath + "o");
if (pyo.exists()) {
filesToDelete.add(pyo);
}
final File file = new File(pyFilePath);
File pycache = new File(file.getParentFile(), PyNames.PYCACHE);
if (pycache.isDirectory()) {
final String shortName = FileUtil.getNameWithoutExtension(file);
Collections.addAll(filesToDelete, pycache.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
if (!FileUtilRt.extensionEquals(pathname.getName(), "pyc")) return false;
String nameWithMagic = FileUtil.getNameWithoutExtension(pathname);
return FileUtil.getNameWithoutExtension(nameWithMagic).equals(shortName);
}
}));
}
FileUtil.asyncDelete(filesToDelete);
}
}
示例4: clearCache
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void clearCache() {
if (cacheDir.exists()) {
File[] cacheFiles = cacheDir.listFiles();
if (cacheFiles != null) {
@SuppressWarnings("unused") // go/futurereturn-lsc
Future<?> possiblyIgnoredError = FileUtil.asyncDelete(Lists.newArrayList(cacheFiles));
}
}
sourceFileToCacheKey = null;
}