trimResourceName and backslashes

Hi there,

While I was debugging a texturing problem (due to location) I've found that in SimpleResourceLocator trimResourceName assumes paths are working URLs and slash is the directory separator.

This is ok if URL is well formatted (as RFC tell us).

In my case resources are mapped from Windows (by people who probably don't know world is made by standards :P) and i've a lot of backslash inside models resources.

Knowing this I'm wondering if something can be improved here to gain fault tolerance.

    protected String trimResourceName(String resourceName) {
        // we are sure this is part of a URL so using slashes only is fine:
        final int firstSlashIndex = resourceName.indexOf( '/' );
        if ( firstSlashIndex >= 0 && firstSlashIndex < resourceName.length() - 1 )
            return resourceName.substring( firstSlashIndex + 1 );
            return null;


maybe something like this?

        if( path.contains( "\" ) ){
            // Regex uses as an escape character, use \ (\\)
            path = path.replaceAll( "\\", "/" );