Package java.nio.file

Examples of java.nio.file.Path


            Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
        }
    }

    private static void copy(File source, File destination) throws IOException {
        Path sourcePath = source.toPath();
        Path destinationPath = destination.toPath();

        destination.getParentFile().mkdirs();

        Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING, LinkOption.NOFOLLOW_LINKS);
View Full Code Here


    testDetectInstall(installPath, compilerPathStr, compilerPathStr, type, pathStrings);
  }
 
  protected void testDetectInstall(Path installPath, String compilerPathStr, String resolvedCompilerPathStr,
      ECompilerType type, List<String> pathStrings) {
    Path compilerPath = installPath.resolve(compilerPathStr).normalize();
    CompilerInstall install = detector.detectInstallFromCompilerCommandPath(compilerPath);
    Path resolvedCompilerPath = installPath.resolve(resolvedCompilerPathStr).normalize();
    checkInstall(install, resolvedCompilerPath, type, installPath, pathStrings);
  }
View Full Code Here

  @Test
  public void testOther() throws Exception { testOther$(); }
  public void testOther$() throws Exception {
    __initModuleParseCache();
   
    Path freeformPath = MiscUtil.createValidPath("#freeFormPath");
    assertTrue(mpc.setWorkingCopyAndGetParsedModule(freeformPath, SOURCE1).source.equals(SOURCE1));
  }
View Full Code Here

 
  protected void testFindResolvedModule(AbstractBundleResolution bundleRes, String moduleNameStr, Path expectedPath)
      throws ParseSourceException {
    ModuleFullName moduleFullName = new ModuleFullName(moduleNameStr);
    ResolvedModule resolvedModule = bundleRes.findResolvedModule(moduleFullName);
    Path modulePath = resolvedModule == null ? null : resolvedModule.getModulePath();
    assertAreEqual(modulePath, expectedPath);
   
    if(expectedPath != null) {
      assertEquals(bundleRes.findModule(moduleFullName.getPackages(), moduleFullName.getModuleSimpleName()),
        resolvedModule.getModuleNode());
View Full Code Here

  }
 
  protected void checkBundleFiles(List<BundleFile> bundleFilesOriginal, List<String> expected) {
    ArrayList<BundleFile> bundleFiles = new ArrayList<>(bundleFilesOriginal);
    for (String expectedFile : expected) {
      final Path expectedPath = MiscUtil.createPathOrNull(expectedFile);
     
      assertTrue(CollectionUtil.removeElement(bundleFiles, new Predicate<BundleFile>() {
        @Override
        public boolean evaluate(BundleFile obj) {
          return areEqual(MiscUtil.createPathOrNull(obj.filePath), expectedPath);
View Full Code Here

    protected void checkEntry(String moduleFullName, String relFilePath) {
      checkEntry(moduleFullName, relFilePath, false);
    }
   
    protected void checkEntry(String moduleFullName, String relFilePath, boolean duplicateEntry) {
      Path filePath = bundleRes.getBundlePath().resolve(relFilePath);
      checkMapContains(modules, new ModuleFullName(moduleFullName), filePath);
      assertTrue(moduleFiles.remove(filePath) == !duplicateEntry);
    }
View Full Code Here

   
    getUpdatedResolution(COMPLEX_LIB);
   
   
    // Test module-file add
    Path newModule = writeToFile(BASIC_LIB.resolve("source/newModule.d"), "module newModule;");
    checkStaleStatus(BASIC_LIB, StaleState.MODULE_LIST_STALE);
    checkStaleStatus(COMPLEX_LIB, StaleState.DEP_STALE);
    checkGetModule(BASIC_LIB, "newModule", null);
    getUpdatedResolution(COMPLEX_LIB);
    checkStaleStatus(BASIC_LIB, StaleState.CURRENT);
View Full Code Here

  protected static final String SOURCE1 = "module change1;";
  protected static final String SOURCE2 = "module change2; /* */";
  protected static final String SOURCE3 = "/* */ module  change3;";
 
  protected void testWorkingCopyModifications() throws ExecutionException, IOException {
    Path modulePath = COMPLEX_LIB.path.resolve("source/complex_lib.d");
   
    writeToFileAndUpdateMTime(modulePath, "module change0;");
    getUpdatedResolution(COMPLEX_BUNDLE);
    getUpdatedResolvedModule(modulePath, "change0");
   
View Full Code Here

    ));
    testFindResolvedModule(resolvedModule.bundleRes, "object", DEFAULT_DMD_INSTALL_LOCATION__Object_Path);
   
   
    // Test getResolvedModule for a relative path.
    Path specialPath = MiscUtil.createValidPath(("###special/relative_bundle.d"));
    sm.parseCache.parseModuleWithNewSource(specialPath, "module relative_bundle;");
    resolvedModule = getUpdatedResolvedModule(specialPath);
    assertEqualSet(resolvedModule.bundleRes.findModules("o"), hashSet(
      "object"
    ));
View Full Code Here

 
  public static final String DUB_MANIFEST_FILENAME = "dub.json";
 
  public static BundlePath create(String pathStr) {
    try {
      Path path = MiscUtil.createPath(pathStr);
      return BundlePath.create(path);
    } catch (InvalidPathExceptionX e) {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of java.nio.file.Path

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.