cordova.create(options.path, options.id, options.name, function(e) { var cfgPath = path.join(options.path, 'www', 'config.xml'), cfgParser = null; self.phonegap.emit('log',PG_STR['args'], options.path, options.id, options.name); if (e) { self.phonegap.emit('error', e); callback(e); return; } // Write out id and name to config.xml if(fs.existsSync(cfgPath)) { self.phonegap.emit('log',PG_STR['custconfig']); cfgParser = new ConfigParser(cfgPath); cfgParser.setPackageName(options.id); cfgParser.setName(options.name); cfgParser.write(); } self.phonegap.emit('log', PG_STR['created'], options.path); callback(null); });
fs.readFile(filePath, 'utf8', function (err,data) { if (err) { return console.log(err); } // Get the config.xml to retrieve the var config = new ConfigParser('config.xml'); var result = data.replace('$PACKAGE_NAME', config.packageName()); fs.writeFile(filePath, result, 'utf8', function (err) { if (err) return console.log(err); }); });