1package org.gffs.filesystem;
4import java.io.FileNotFoundException;
5import java.nio.file.Files;
6import java.nio.file.Path;
8import org.apache.commons.logging.Log;
9import org.apache.commons.logging.LogFactory;
21 path = path.replaceAll(
"\\+",
"/");
24 if (!path.startsWith(
"/")) {
25 String msg =
"path passed in was not absolute: '" + path +
"'";
27 throw new FileNotFoundException(msg);
31 path = path.replaceAll(
"//",
"/");
32 String[] components = path.split(
"/");
34 String currentPath =
"";
35 for (String component : components) {
36 currentPath = currentPath +
"/" + component;
54 Path nioPath = path.toPath();
55 return Files.isSymbolicLink(nioPath);
67 String toReturn = toClean.replace(
'\\',
'/');
75 static public void main(String[] args)
77 String uglyPath =
"C:\\Program Files\\GenesisII\\";
79 String expectedPath =
"C:/Program Files/GenesisII/";
80 if (!fixedPath.equals(expectedPath)) {
81 System.err.println(
"FAILURE IN PARSING! result is not right: '" + fixedPath +
"' when it should be '" + expectedPath);
84 System.err.println(
"parsing occurred as expected.");
static String sanitizeFilename(String toClean)
static boolean pathContainsLink(String path)
static boolean isFileSymLink(File path)
static void main(String[] args)