本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.copyDir方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.copyDir方法的具体用法?Java FileUtil.copyDir怎么用?Java FileUtil.copyDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.copyDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCopyFormsRuntimeToArtifact
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCopyFormsRuntimeToArtifact() throws IOException {
VirtualFile file = createFile("src/A.java", "class A{}");
VirtualFile srcRoot = file.getParent();
Module module = addModule("a", srcRoot);
Artifact a = addArtifact(root().module(module));
make(a);
assertOutput(a, fs().file("A.class"));
File dir = PathManagerEx.findFileUnderCommunityHome("plugins/ui-designer/testData/build/copyFormsRuntimeToArtifact");
FileUtil.copyDir(dir, VfsUtilCore.virtualToIoFile(srcRoot));
srcRoot.refresh(false, false);
make(a);
File outputDir = VfsUtilCore.virtualToIoFile(getOutputDir(a));
assertTrue(new File(outputDir, "A.class").exists());
assertTrue(new File(outputDir, "B.class").exists());
assertTrue(new File(outputDir, AbstractLayout.class.getName().replace('.', '/') + ".class").exists());
}
示例2: restoreSources
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void restoreSources() {
Runnable runnable = new Runnable() {
@Override
public void run() {
try {
FileUtil.copyDir(new File(JavaTestUtil.getJavaTestDataPath() + "/psi/arrayIndexOutOfBounds/src"),
VfsUtilCore.virtualToIoFile(myProjectRoot));
}
catch (IOException e) {
LOG.error(e);
}
VirtualFileManager.getInstance().syncRefresh();
}
};
CommandProcessor.getInstance().executeCommand(myProject, runnable, "", null);
}
示例3: copyDirectoryToProject
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
@Override
public VirtualFile copyDirectoryToProject(@NotNull @NonNls final String sourceFilePath, @NotNull @NonNls final String targetPath) {
final String testDataPath = getTestDataPath();
final File fromFile = new File(testDataPath + "/" + sourceFilePath);
if (myTempDirFixture instanceof LightTempDirTestFixtureImpl) {
return myTempDirFixture.copyAll(fromFile.getPath(), targetPath);
}
final File targetFile = new File(getTempDirPath() + "/" + targetPath);
try {
FileUtil.copyDir(fromFile, targetFile);
}
catch (IOException e) {
throw new RuntimeException(e);
}
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(targetFile);
Assert.assertNotNull(file);
file.refresh(false, true);
return file;
}
示例4: testReverseMerge
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testReverseMerge() throws Exception {
String tempDirPath = myFixture.getTempDirPath();
File newSdk = new File(tempDirPath, "dest-sdk");
FileUtil.copyDir(new File(getTestDataPath(), "sdk20-stub"), newSdk);
File oldSdk = new File(getTestDataPath(), "sdkL-stub");
assertEquals(SDK_L_FINGERPRINT,
getSdkFingerprint(oldSdk));
assertEquals(SDK_20_FINGERPRINT,
getSdkFingerprint(newSdk));
assertTrue(SdkMerger.hasMergeableContent(oldSdk, newSdk));
SdkMerger.mergeSdks(oldSdk, newSdk, null);
assertFalse(SdkMerger.hasMergeableContent(oldSdk, newSdk));
assertEquals(MERGED_FINGERPRINT, getSdkFingerprint(newSdk));
assertTrue(new File(newSdk, "platforms/android-8/data/activity_actions.txt").exists());
assertTrue(new File(newSdk, "platforms/android-15/data/activity_actions.txt").exists());
}
示例5: testCreationOfExcludedDirWithFilesDuringRefreshShouldNotThrowException
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCreationOfExcludedDirWithFilesDuringRefreshShouldNotThrowException() throws Exception {
// there was a problem with the DirectoryIndex - the files that were created during the refresh
// were not correctly excluded, thereby causing the LocalHistory to fail during addition of
// files under the excluded dir.
File targetDir = createTargetDir();
FileUtil.copyDir(targetDir, new File(myRoot.getPath(), "target"));
VirtualFileManager.getInstance().syncRefresh();
String classesPath = myRoot.getPath() + "/target/classes";
addExcludedDir(classesPath);
final VirtualFile classesDir = LocalFileSystem.getInstance().findFileByPath(classesPath);
assertNotNull(classesDir);
classesDir.getParent().delete(this);
FileUtil.copyDir(targetDir, new File(myRoot.getPath(), "target"));
VirtualFileManager.getInstance().syncRefresh(); // shouldn't throw
}
示例6: testConvert
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testConvert() throws IOException {
final String testDataPath = AndroidTestCase.getTestDataPath() + "/conversion/proguardOptions";
final File testData = new File(testDataPath, "before");
final File tempDir = FileUtil.createTempDirectory("project", null);
FileUtil.copyDir(testData, tempDir);
ProjectConversionTestUtil.convert(tempDir.getAbsolutePath());
final File expectedDataDir = new File(testDataPath, "after");
PlatformTestUtil.assertDirectoriesEqual(
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(expectedDataDir),
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDir),
new VirtualFileFilter() {
@Override
public boolean accept(VirtualFile file) {
return !file.getName().startsWith(ProjectConversionUtil.PROJECT_FILES_BACKUP);
}
});
}
示例7: testExternalApklib2
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testExternalApklib2() throws Exception {
setRepositoryPath(new File(myDir, "__repo").getPath());
FileUtil.copyDir(new File(AndroidTestCase.getTestDataPath() + "/maven/myapklib"), new File(getRepositoryPath(), "com/myapklib/1.0"));
FileUtil.copyDir(new File(AndroidTestCase.getTestDataPath() + "/maven/myjar"), new File(getRepositoryPath(), "com/myjar/1.0"));
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = AndroidTestCase.getDefaultTestSdkPath();
try {
importProject(getPomContent("apk", "module", "") +
"<dependencies>" +
" <dependency>" +
" <groupId>com</groupId>\n" +
" <artifactId>myapklib</artifactId>\n" +
" <version>1.0</version>\n" +
" <type>apklib</type>" +
" <scope>provided</scope>" +
" </dependency>" +
"</dependencies>");
assertModules("module");
}
finally {
AndroidFacetImporterBase.ANDROID_SDK_PATH_TEST = null;
// do not lock files by maven process
MavenServerManager.getInstance().shutdown(true);
}
}
示例8: initFiles
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void initFiles(Project project) throws IOException {
pathHelper = new PathHelper(project);
apkPath = PropertiesManager.getData(project, PropertyKeys.APK_PATH);
File webDir = new File(pathHelper.getWebDir());
if (!webDir.exists()) {
FileUtil.copyDir(
new File(pathHelper.replaceCharWithSpace(getClass().getResource("/web").getPath())),
webDir
);
}
}
示例9: setUpDataClasses
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void setUpDataClasses() throws Exception {
File classesDir = new File(Test01.class.getResource("/" + Test01.class.getPackage().getName().replace('.', '/')).toURI());
File destDir = new File(myModule.getProject().getBaseDir().getPath() + myClassesProjectRelativePath);
FileUtil.copyDir(classesDir, destDir);
VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(destDir);
assertNotNull(vFile);
PsiTestUtil.addLibrary(myModule, "dataClasses", vFile.getPath(), new String[]{""}, ArrayUtil.EMPTY_STRING_ARRAY);
}
示例10: cloneToModule
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void cloneToModule(String gitUrl) throws ServerRuntimeException {
File cloneDir = cloneToTemp(gitUrl);
try {
FileUtil.copyDir(cloneDir, getRepositoryRootFile());
}
catch (IOException e) {
throw new ServerRuntimeException(e);
}
refreshApplicationRepository();
}
示例11: setUp
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
myOlderDir = getDataDir();
myNewerDir = getTempFile("newDir");
FileUtil.copyDir(myOlderDir, myNewerDir);
FileUtil.delete(new File(myNewerDir, "bin/idea.bat"));
FileUtil.writeToFile(new File(myNewerDir, "Readme.txt"), "hello".getBytes());
File newFile = new File(myNewerDir, "newDir/newFile.txt");
newFile.getParentFile().mkdirs();
newFile.createNewFile();
FileUtil.writeToFile(newFile, "hello".getBytes());
FileUtil.delete(new File(myOlderDir, "lib/annotations_changed.jar"));
FileUtil.delete(new File(myNewerDir, "lib/annotations.jar"));
FileUtil.rename(new File(myNewerDir, "lib/annotations_changed.jar"),
new File(myNewerDir, "lib/annotations.jar"));
FileUtil.delete(new File(myOlderDir, "lib/bootstrap_deleted.jar"));
FileUtil.delete(new File(myNewerDir, "lib/bootstrap.jar"));
FileUtil.rename(new File(myNewerDir, "lib/bootstrap_deleted.jar"),
new File(myNewerDir, "lib/bootstrap.jar"));
FileUtil.delete(new File(myOlderDir, "lib/boot2_changed_with_unchanged_content.jar"));
FileUtil.delete(new File(myNewerDir, "lib/boot2.jar"));
FileUtil.rename(new File(myNewerDir, "lib/boot2_changed_with_unchanged_content.jar"),
new File(myNewerDir, "lib/boot2.jar"));
}
示例12: setUp
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Runner.initLogger();
myTempDirFixture = IdeaTestFixtureFactory.getFixtureFactory().createTempDirTestFixture();
myTempDirFixture.setUp();
FileUtil.copyDir(PathManagerEx.findFileUnderCommunityHome("updater/testData"), getDataDir());
boolean windowsLineEnds = new File(getDataDir(), "Readme.txt").length() == 7132;
CHECKSUMS = new CheckSums(windowsLineEnds);
}
示例13: copyResultsToArtifactsOutput
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void copyResultsToArtifactsOutput(final File tempDirectory) {
try {
final File resultedJar = new File(getArtifactOutputPath());
FileUtil.copyDir(tempDirectory, resultedJar);
}
catch (IOException e) {
LOG.info(e);
}
FileUtil.delete(tempDirectory);
}
示例14: getBundledJava
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static String getBundledJava(String javaHome) throws Exception {
String javaHomeCopy = System.getProperty("user.home") + "/." + System.getProperty("idea.paths.selector") + "/restart/jre";
File javaCopy = SystemInfoRt.isWindows ? new File(javaHomeCopy + "/bin/java.exe") : new File(javaHomeCopy + "/bin/java");
if (javaCopy != null && javaCopy.isFile() && checkBundledJava(javaCopy)) {
javaHome = javaHomeCopy;
}
if (javaHome != javaHomeCopy) {
File javaHomeCopyDir = new File(javaHomeCopy);
if (javaHomeCopyDir.exists()) FileUtil.delete(javaHomeCopyDir);
System.out.println("Updater: java: " + javaHome + " copied to " + javaHomeCopy);
FileUtil.copyDir(new File(javaHome), javaHomeCopyDir);
javaHome = javaHomeCopy;
}
return javaHome;
}
示例15: setUp
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
myHgDir = new File(myRepository.getPath(), ".hg");
assertTrue(myHgDir.exists());
File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea"));
String pathToHg = "testData/repo/dot_hg";
File testHgDir = new File(pluginRoot, FileUtil.toSystemDependentName(pathToHg));
File cacheDir = new File(testHgDir, "cache");
File testDirStateFile = new File(testHgDir, "dirstate");
File testBranchFile = new File(testHgDir, "branch");
File testBookmarkFile = new File(testHgDir, "bookmarks");
File testCurrentBookmarkFile = new File(testHgDir, "bookmarks.current");
File testTagFile = new File(testHgDir.getParentFile(), ".hgtags");
File testLocalTagFile = new File(testHgDir, "localtags");
FileUtil.copyDir(cacheDir, new File(myHgDir, "cache"));
FileUtil.copy(testBranchFile, new File(myHgDir, "branch"));
FileUtil.copy(testDirStateFile, new File(myHgDir, "dirstate"));
FileUtil.copy(testBookmarkFile, new File(myHgDir, "bookmarks"));
FileUtil.copy(testCurrentBookmarkFile, new File(myHgDir, "bookmarks.current"));
FileUtil.copy(testTagFile, new File(myHgDir.getParentFile(), ".hgtags"));
FileUtil.copy(testLocalTagFile, new File(myHgDir, "localtags"));
myRepositoryReader = new HgRepositoryReader(myVcs, myHgDir);
myBranches = readBranches();
myBookmarks = readRefs(testBookmarkFile);
myTags = readRefs(testTagFile);
myLocalTags = readRefs(testLocalTagFile);
}