private String normalizePath ( String scriptPath ) { StringBuilder builder = new StringBuilder ( scriptPath . length ( ) + 1 ) ; if ( scriptPath . startsWith ( "/" ) ) { builder . append ( scriptPath . substring ( 1 ) ) ; } else { builder . append ( scriptPath ) ; } if ( ! scriptPath . endsWith ( "/" ) ) { builder . append ( "/" ) ; } return builder . toString ( ) ; }
Ensures that every path starts and ends with a slash character .