1 package org.gffs.filesystem;
4 import java.io.FileNotFoundException;
5 import java.nio.file.Files;
6 import java.nio.file.Path;
8 import org.apache.commons.logging.Log;
9 import org.apache.commons.logging.LogFactory;
24 if (!
path.startsWith(
"/")) {
25 String msg =
"path passed in was not absolute: '" +
path +
"'";
27 throw new FileNotFoundException(msg);
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)