B2G/gecko/netwerk/test/unit/test_filestreams.js
/**
 * Generates a leafName for a file that does not exist, but does *not*
 * create the file. Similar to createUnique except for the fact that createUnique
 * does create the file.
 *
 * @param aFile
 *        The file to modify in order for it to have a unique leafname.
 */
Generates a leafName for a file that does not exist, but does *not
create the file. Similar to createUnique except for the fact that createUnique
does create the file.

@param aFile
The file to modify in order for it to have a unique leafname.
Generates a leafName for a file that does not exist but does * not create the file . Similar to createUnique except for the fact that createUnique does create the file . @param aFile The file to modify in order for it to have a unique leafname .
function ensure_unique(aFile)
{
  ensure_unique.fileIndex = ensure_unique.fileIndex || 0;
  var leafName = aFile.leafName;
  while (aFile.clone().exists()) {
    aFile.leafName = leafName + "_" + (ensure_unique.fileIndex++);
  }
}
function ensure_unique ( aFile ) { ensure_unique . fileIndex = ensure_unique . fileIndex || 0 ; var leafName = aFile . leafName ; while ( aFile . clone ( ) . exists ( ) ) { aFile . leafName = leafName + "_" + ( ensure_unique . fileIndex ++ ) ; } }
Generates a leafName for a file that does not exist, but does *not
 create the file.
Generates a leafName for a file that does not exist but does * not create the file .