static String toUnixStylePath(String absolutePath) {
        if (StringUtils.isEmpty(absolutePath)) {
            throw new IllegalStateException("empty path given");
        }
        if (absolutePath.startsWith("/")) {
            return absolutePath;
        } else if (absolutePath.length()>=2 && Character.isLetter(absolutePath.charAt(0)) && ':' == absolutePath.charAt(1) && '\\' == absolutePath.charAt(2)) {
            char driveLetter = Character.toLowerCase(absolutePath.charAt(0));
            String drivePath = StringUtils.substringAfter(absolutePath, ":");
            String drivePathUnixStyle = drivePath.replace('\\', '/');
            return "/"+driveLetter+drivePathUnixStyle;
        } else {
            throw new IllegalStateException(String.format("unable to convert path %s", absolutePath));
        }
    }
static String toUnixStylePath ( String absolutePath ) { if ( StringUtils . isEmpty ( absolutePath ) ) { throw new IllegalStateException ( "empty path given" ) ; } if ( absolutePath . startsWith ( "/" ) ) { return absolutePath ; } else if ( absolutePath . length ( ) >= 2 && Character . isLetter ( absolutePath . charAt ( 0 ) ) && ':' == absolutePath . charAt ( 1 ) && '\\' == absolutePath . charAt ( 2 ) ) { char driveLetter = Character . toLowerCase ( absolutePath . charAt ( 0 ) ) ; String drivePath = StringUtils . substringAfter ( absolutePath , ":" ) ; String drivePathUnixStyle = drivePath . replace ( '\\' , '/' ) ; return "/" + driveLetter + drivePathUnixStyle ; } else { throw new IllegalStateException ( String . format ( "unable to convert path %s" , absolutePath ) ) ; } }
Convert any absolute path (no matter Unix or Windows style) to Unix style
path compatible to docker volume mount from syntax.