dap4/d4core/src/main/java/dap4/core/util/DapUtil.java
static public String
    canonicalpath(String path)
    {
        if(path == null) return null;
        path = path.trim();
        path = path.replace('\\', '/');
        if(path.endsWith("/"))
            path = path.substring(0, path.length() - 1);
        boolean abs = (path.length() > 0 && path.charAt(0) == '/');
        if(abs) path = path.substring(1); // temporary
        if(DapUtil.hasDriveLetter(path)) {
            // As a last step, lowercase the drive letter, if any
            path = path.substring(0, 1).toLowerCase() + path.substring(1);
        } else if(abs)
            path = "/" + path;
        return path;
    }
static public String
    canonicalpath(String path)
    {
        if(path == null) return null;
        path = path.trim();
        path = path.replace('\\', '/');
        if(path.endsWith("/"))
            path = path.substring(0, path.length() - 1);
        boolean abs = (path.length() > 0 && path.charAt(0) == '/');
        if(abs) path = path.substring(1); // temporary
        if(DapUtil.hasDriveLetter(path)) {
            // As a last step, lowercase the drive letter, if any
            path = path.substring(0, 1).toLowerCase() + path.substring(1);
        } else if(abs)
            path = "/" + path;
        return path;
    }
static public String canonicalpath ( String path ) { if ( path == null ) return null ; path = path . trim ( ) ; path = path . replace ( ' ' , ' ' ) ; if ( path . endsWith ( "/" ) ) path = path . substring ( 0 , path . length ( ) - 1 ) ; boolean abs = ( path . length ( ) > 0 && path . charAt ( 0 ) == ' ' ) ; if ( abs ) path = path . substring ( 1 ) ; // temporary if ( DapUtil . hasDriveLetter ( path ) ) { // As a last step, lowercase the drive letter, if any path = path . substring ( 0 , 1 ) . toLowerCase ( ) + path . substring ( 1 ) ; } else if ( abs ) path = "/" + path ; return path ; }
Convert path to:
1. use '/' consistently
2. remove any trailing '/'
3. trim blanks
4. Be aware of possible windows drive letter

@param path convert this path
@return canonicalized version
Convert path to : 1 . use / consistently 2 . remove any trailing / 3 . trim blanks 4 . Be aware of possible windows drive letter