Package drivers

Class ResolvePath

java.lang.Object
drivers.ResolvePath

public class ResolvePath extends Object
This tries to resolve a filepath which may contain "./", "ยค/","~/" or (several of) "../", as well as "/" or "\" as separator.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create the object, with a path (as string) to the current base dir.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    resolvePath(String pName, boolean addSep)
    Gets the canonical path of a file: First convert all "/" or "\" to the file separator used in this JVM, then get the canonical path of the file.Canonical path here means a path where all path abbreviations (such as "../") are resolved.
    static String[]
    resolvePaths(String[] pName, boolean addSep)
    Resolve all pathnames in the array passed as parameter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INIFILE_DIR

      public static String INIFILE_DIR
  • Constructor Details

    • ResolvePath

      public ResolvePath(String f)
      Create the object, with a path (as string) to the current base dir.
      Parameters:
      f -
  • Method Details

    • resolvePath

      public static String resolvePath(String pName, boolean addSep)
      Gets the canonical path of a file: First convert all "/" or "\" to the file separator used in this JVM, then get the canonical path of the file.Canonical path here means a path where all path abbreviations (such as "../") are resolved.
      Parameters:
      pName - pathname of a file
      addSep - flag whether a path separator should be added at end (if true: add, else remove it if it is there)
      Returns:
      the canonicial path (where all path abbreviations are resolved) or "" if any problem (i.e. null, empty or invalid path name passed as parameter).
    • resolvePaths

      public static String[] resolvePaths(String[] pName, boolean addSep)
      Resolve all pathnames in the array passed as parameter.
      Parameters:
      pName - array with pathnames to solve
      addSep - flag whether a path separator should be added (if true: add)
      Returns: