B2G/gecko/toolkit/mozapps/update/test/shared.js
/**
 * Removes the updates.xml file, active-update.xml file, and all files and
 * sub-directories in the updates directory except for the "0" sub-directory.
 * This prevents some tests from failing due to files being left behind when the
 * tests are interrupted.
 */
Removes the updates.xml file, active-update.xml file, and all files and
sub-directories in the updates directory except for the "0" sub-directory.
This prevents some tests from failing due to files being left behind when the
tests are interrupted.
Removes the updates . xml file active - update . xml file and all files and sub - directories in the updates directory except for the " 0 " sub - directory . This prevents some tests from failing due to files being left behind when the tests are interrupted .
function removeUpdateDirsAndFiles() {
  var file = getUpdatesXMLFile(true);
  try {
    if (file.exists())
      file.remove(false);
  }
  catch (e) {
    dump("Unable to remove file\npath: " + file.path +
         "\nException: " + e + "\n");
  }
  file = getUpdatesXMLFile(false);
  try {
    if (file.exists())
      file.remove(false);
  }
  catch (e) {
    dump("Unable to remove file\npath: " + file.path +
         "\nException: " + e + "\n");
  }
  var updatesDir = getUpdatesDir();
  try {
    cleanUpdatesDir(updatesDir);
  }
  catch (e) {
    dump("Unable to remove files / directories from directory\npath: " +
         updatesDir.path + "\nException: " + e + "\n");
  }
}
function removeUpdateDirsAndFiles ( ) { var file = getUpdatesXMLFile ( true ) ; try { if ( file . exists ( ) ) file . remove ( false ) ; } catch ( e ) { dump ( "Unable to remove file\npath: " + file . path + "\nException: " + e + "\n" ) ; } file = getUpdatesXMLFile ( false ) ; try { if ( file . exists ( ) ) file . remove ( false ) ; } catch ( e ) { dump ( "Unable to remove file\npath: " + file . path + "\nException: " + e + "\n" ) ; } var updatesDir = getUpdatesDir ( ) ; try { cleanUpdatesDir ( updatesDir ) ; } catch ( e ) { dump ( "Unable to remove files / directories from directory\npath: " + updatesDir . path + "\nException: " + e + "\n" ) ; } }
Removes the updates.xml file, active-update.xml file, and all files and
 sub-directories in the updates directory except for the "0" sub-directory.
Removes the updates . xml file active - update . xml file and all files and sub - directories in the updates directory except for the " 0 " sub - directory .
// This fails sporadically on Mac OS X so wrap it in a try catch