Package java.nio.file

Examples of java.nio.file.Path.resolve()


        try {
            if (!Files.exists(cache))
                Files.createDirectory(cache);
            if (!Files.exists(cache.resolve(APP_CACHE_NAME)))
                Files.createDirectory(cache.resolve(APP_CACHE_NAME));
            if (!Files.exists(cache.resolve(DEPS_CACHE_NAME)))
                Files.createDirectory(cache.resolve(DEPS_CACHE_NAME));

            return cache;
        } catch (IOException e) {
            throw new RuntimeException("Error opening cache directory " + cache.toAbsolutePath(), e);
View Full Code Here


            if (!Files.exists(cache))
                Files.createDirectory(cache);
            if (!Files.exists(cache.resolve(APP_CACHE_NAME)))
                Files.createDirectory(cache.resolve(APP_CACHE_NAME));
            if (!Files.exists(cache.resolve(DEPS_CACHE_NAME)))
                Files.createDirectory(cache.resolve(DEPS_CACHE_NAME));

            return cache;
        } catch (IOException e) {
            throw new RuntimeException("Error opening cache directory " + cache.toAbsolutePath(), e);
        }
View Full Code Here

                        localData = Paths.get(userHome, "Local Settings", "Application Data");
                    if (!Files.isDirectory(localData))
                        throw new RuntimeException("%LOCALAPPDATA% is undefined, and neither "
                                + Paths.get(userHome, "AppData", "Local") + " nor "
                                + Paths.get(userHome, "Local Settings", "Application Data") + " have been found");
                    cache = localData.resolve(cacheName);
                }
            } else
                cache = Paths.get(userHome, "." + cacheName);
        }
        try {
View Full Code Here

      Path myJarDir = myJar.getParent();

      if (pathToConfigFile != null) {
        configFile = Paths.get(pathToConfigFile);
        if (!configFile.isAbsolute()) {
          configFile = myJarDir.resolve(pathToConfigFile);
        }
      } else {
        configFile = myJarDir.resolve("config.yaml");
      }
View Full Code Here

        configFile = Paths.get(pathToConfigFile);
        if (!configFile.isAbsolute()) {
          configFile = myJarDir.resolve(pathToConfigFile);
        }
      } else {
        configFile = myJarDir.resolve("config.yaml");
      }

      if (Files.exists(configFile)) {
        try (InputStream is = Files.newInputStream(configFile)) {
          Yaml yaml = new Yaml();
View Full Code Here

                        localData = Paths.get(userHome, "Local Settings", "Application Data");
                    if (!Files.isDirectory(localData))
                        throw new RuntimeException("%LOCALAPPDATA% is undefined, and neither "
                                + Paths.get(userHome, "AppData", "Local") + " nor "
                                + Paths.get(userHome, "Local Settings", "Application Data") + " have been found");
                    cache = localData.resolve(cacheName);
                }
            } else
                cache = Paths.get(userHome, "." + cacheName);
        }
        try {
View Full Code Here

                Path siblingDir = null;
                if (sibling != null && sibling instanceof PathFileObject) {
                    siblingDir = ((PathFileObject) sibling).getPath().getParent();
                }
                return PathFileObject.createSiblingPathFileObject(this,
                        siblingDir.resolve(getBaseName(relativePath)),
                        relativePath);
            } else if (location == SOURCE_OUTPUT) {
                dir = getOutputLocation(CLASS_OUTPUT);
            }
        }
View Full Code Here

        File innerDir = new File(newDir, "innerDir");
        innerDir.mkdir();
        Path innerDirPath = innerDir.toPath();

        Files.copy(filePath.toPath(), newDirPath.resolve(filePath.toPath().getFileName()));
        Files.copy(filePath.toPath(), innerDirPath.resolve(filePath.toPath().getFileName()));

        File newSymlink = new File(rootPath, "newSymlink");
        Path newSymlinkPath = newSymlink.toPath();

        Files.createSymbolicLink(newSymlinkPath, newDirPath);
View Full Code Here

           
            // No, so let's check each element ourselves
            Path d = path.getRoot();
            for (Path e:path)
            {
                d=d.resolve(e);
               
                while (Files.exists(d) && Files.isSymbolicLink(d))
                {
                    Path link=Files.readSymbolicLink(d);                   
                    if (!link.isAbsolute())
View Full Code Here

                        localData = Paths.get(userHome, "Local Settings", "Application Data");
                    if (!Files.isDirectory(localData))
                        throw new RuntimeException("%LOCALAPPDATA% is undefined, and neither "
                                + Paths.get(userHome, "AppData", "Local") + " nor "
                                + Paths.get(userHome, "Local Settings", "Application Data") + " have been found");
                    cache = localData.resolve(cacheName);
                }
            } else
                cache = Paths.get(userHome, "." + cacheName);
        }
        try {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.