lib/js/AppTemplate.js
function(dirpath) {
    try {

      // Make the directory under the app
      if (dirpath !== '/') {
        FS.mkdirSync(Path.join('.', appPath, dirpath));
      }

      // Read the template directory
      var templateDir = Path.join(__dirname, '../template/app', dirpath);
      var files = FS.readdirSync(templateDir);
      files.forEach(function(file) {
        var fullFile = Path.join(templateDir, file);
        var stat = FS.statSync(fullFile);
        if (stat.isDirectory()) {
          // Go into it
          outputDir(Path.join(dirpath, file));
        }
        else {
          outputFile(dirpath, file);
        }
      });

    } catch(e) {
      logger.fatal('Template', 'Cannot process template directory: ' + dirpath + '. reason: ', e.toString());
      process.exit(1);
    }
  }
function(dirpath) {
    try {

      // Make the directory under the app
      if (dirpath !== '/') {
        FS.mkdirSync(Path.join('.', appPath, dirpath));
      }

      // Read the template directory
      var templateDir = Path.join(__dirname, '../template/app', dirpath);
      var files = FS.readdirSync(templateDir);
      files.forEach(function(file) {
        var fullFile = Path.join(templateDir, file);
        var stat = FS.statSync(fullFile);
        if (stat.isDirectory()) {
          // Go into it
          outputDir(Path.join(dirpath, file));
        }
        else {
          outputFile(dirpath, file);
        }
      });

    } catch(e) {
      logger.fatal('Template', 'Cannot process template directory: ' + dirpath + '. reason: ', e.toString());
      process.exit(1);
    }
  }
function ( dirpath ) { try { // Make the directory under the app if ( dirpath !== '/' ) { FS . mkdirSync ( Path . join ( '.' , appPath , dirpath ) ) ; } // Read the template directory var templateDir = Path . join ( __dirname , '../template/app' , dirpath ) ; var files = FS . readdirSync ( templateDir ) ; files . forEach ( function ( file ) { var fullFile = Path . join ( templateDir , file ) ; var stat = FS . statSync ( fullFile ) ; if ( stat . isDirectory ( ) ) { // Go into it outputDir ( Path . join ( dirpath , file ) ) ; } else { outputFile ( dirpath , file ) ; } } ) ; } catch ( e ) { logger . fatal ( 'Template' , 'Cannot process template directory: ' + dirpath + '. reason: ' , e . toString ( ) ) ; process . exit ( 1 ) ; } }
Traverse the app template directory, outputting all files
Traverse the app template directory outputting all files