B2G/gecko/testing/mochitest/chrome-harness.js
/*
 * Simple utility function to take the directory structure in jarentryname and 
 * translate that to a path of a nsILocalFile.
 */
Simple utility function to take the directory structure in jarentryname and
translate that to a path of a nsILocalFile.
Simple utility function to take the directory structure in jarentryname and translate that to a path of a nsILocalFile .
function buildRelativePath(jarentryname, destdir, basepath)
{
  var baseParts = basepath.split('/');
  if (baseParts[baseParts.length-1] == '') {
    baseParts.pop();
  }
  var parts = jarentryname.split('/');
  var targetFile = Components.classes["@mozilla.org/file/local;1"]
                   .createInstance(Components.interfaces.nsILocalFile);
  targetFile.initWithFile(destdir);
  for (var i = baseParts.length; i < parts.length; i++) {
    targetFile.append(parts[i]);
  }
  return targetFile;
}
function buildRelativePath ( jarentryname , destdir , basepath ) { var baseParts = basepath . split ( '/' ) ; if ( baseParts [ baseParts . length - 1 ] == '' ) { baseParts . pop ( ) ; } var parts = jarentryname . split ( '/' ) ; var targetFile = Components . classes [ "@mozilla.org/file/local;1" ] . createInstance ( Components . interfaces . nsILocalFile ) ; targetFile . initWithFile ( destdir ) ; for ( var i = baseParts . length ; i < parts . length ; i ++ ) { targetFile . append ( parts [ i ] ) ; } return targetFile ; }
Simple utility function to take the directory structure in jarentryname and
 translate that to a path of a nsILocalFile.
Simple utility function to take the directory structure in jarentryname and translate that to a path of a nsILocalFile .