當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.copyDir方法代碼示例

本文整理匯總了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());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:UiDesignerExternalBuildTest.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ArrayIndexOutOfBoundsTest.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:CodeInsightTestFixtureImpl.java

示例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());

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:SdkMergerTest.java

示例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
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ExternalChangesAndRefreshingTest.java

示例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);
      }
    });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:AndroidConversionTest.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:AndroidFacetImporterTest.java

示例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
            );
        }
    }
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:15,代碼來源:GenerateDependencyInjectionGraph.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:BytecodeAnalysisTest.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:CloudGitDeploymentRuntime.java

示例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"));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:PatchTestCase.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:UpdaterTestCase.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:AbstractJavaFxPackager.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:Main.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:HgRepositoryReaderTest.java


注:本文中的com.intellij.openapi.util.io.FileUtil.copyDir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。