Set application's name and version from the package.json.

This commit is contained in:
Cheng Zhao 2013-12-05 11:30:06 +08:00
parent 0229c3187b
commit 284160bf2d

View file

@ -59,5 +59,15 @@ catch error
packagePath = path.join process.resourcesPath, 'browser', 'default_app'
packageJson = JSON.parse(fs.readFileSync(path.join(packagePath, 'package.json')))
# Set application's version.
app = require 'app'
app.setVersion packageJson.version if packageJson.version?
# Set application's name.
if packageJson.productName?
app.setName packageJson.productName
else if packageJson.name?
app.setName packageJson.name
# Finally load app's main.js and transfer control to C++.
require path.join(packagePath, packageJson.main)