public static String getPathNoTrailingSlash(String path) {
        if ( path.equals("") ) {
            return ".";
        }
        if ( path.equals("/") ) {
            return "/.";
        }
        if ( path.endsWith("/") ) {
            // Remove trailing slash
            path = path.substring(0, path.length() -1);
        }
        return path;
    }