+ /** Returns a path, based on console input. */
+ private String path(String c) {
+ if (c.equals("") || c.equals(".") || c.equals("/")) {
+ c = ".";
+ } else if (c.equals("..")) {
+ c = c.substring(0, c.lastIndexOf('.'));
+ if (c.equals("")) c = ".";
+ } else {
+ if (c.charAt(0) != '/') c = pwd + c;
+ c = c.replaceAll("/+", ".");
+ if (c.length() > 1 && c.charAt(c.length() - 1) == '.')
+ c = c.substring(0, c.length() - 1);
+ }
+
+ return c;
+ }
+