cordova/mpdjs/jsbuild/r.js
function (path) {
                //There has to be an easier way to do this.
                var i, part, ary,
                    firstChar = path.charAt(0);

                if (firstChar !== '/' &&
                        firstChar !== '\\' &&
                        path.indexOf(':') === -1) {
                    //A relative path. Use the current working directory.
                    path = xpcUtil.cwd() + '/' + path;
                }

                ary = path.replace(/\\/g, '/').split('/');

                for (i = 0; i < ary.length; i += 1) {
                    part = ary[i];
                    if (part === '.') {
                        ary.splice(i, 1);
                        i -= 1;
                    } else if (part === '..') {
                        ary.splice(i - 1, 2);
                        i -= 2;
                    }
                }
                return ary.join('/');
            }
function (path) {
                //There has to be an easier way to do this.
                var i, part, ary,
                    firstChar = path.charAt(0);

                if (firstChar !== '/' &&
                        firstChar !== '\\' &&
                        path.indexOf(':') === -1) {
                    //A relative path. Use the current working directory.
                    path = xpcUtil.cwd() + '/' + path;
                }

                ary = path.replace(/\\/g, '/').split('/');

                for (i = 0; i < ary.length; i += 1) {
                    part = ary[i];
                    if (part === '.') {
                        ary.splice(i, 1);
                        i -= 1;
                    } else if (part === '..') {
                        ary.splice(i - 1, 2);
                        i -= 2;
                    }
                }
                return ary.join('/');
            }
function ( path ) { //There has to be an easier way to do this. var i , part , ary , firstChar = path . charAt ( 0 ) ; if ( firstChar !== '/' && firstChar !== '\\' && path . indexOf ( ':' ) === - 1 ) { //A relative path. Use the current working directory. path = xpcUtil . cwd ( ) + '/' + path ; } ary = path . replace ( / \\ / g , '/' ) . split ( '/' ) ; for ( i = 0 ; i < ary . length ; i += 1 ) { part = ary [ i ] ; if ( part === '.' ) { ary . splice ( i , 1 ) ; i -= 1 ; } else if ( part === '..' ) { ary . splice ( i - 1 , 2 ) ; i -= 2 ; } } return ary . join ( '/' ) ; }
Remove . and .. from paths, normalize on front slashes
Remove . and .. from paths normalize on front slashes