Class OSUtils.ResourceUtils

  • Enclosing class:
    OSUtils

    public static class OSUtils.ResourceUtils
    extends java.lang.Object
    A class for getting relative file paths Source modified from original version at http://stackoverflow.com/questions/204784/how-to-construct-a-relative-path-in-java-from-two-absolute-paths-or-urls
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getRelativePath​(java.lang.String targetPath, java.lang.String basePath, java.lang.String pathSeparator)
      Get the relative path from one file to another, specifying the directory separator.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResourceUtils

        public ResourceUtils()
    • Method Detail

      • getRelativePath

        public static java.lang.String getRelativePath​(java.lang.String targetPath,
                                                       java.lang.String basePath,
                                                       java.lang.String pathSeparator)
        Get the relative path from one file to another, specifying the directory separator. If one of the provided resources does not exist, it is assumed to be a file unless it ends with '/' or '\'.
        Parameters:
        targetPath - targetPath is calculated to this file
        basePath - basePath is calculated from this file
        pathSeparator - directory separator. The platform default is not assumed so that we can test Unix behavior when running on Windows (for example)
        Returns: