Make use of package.json display name to reference the app

Our `package.json` contains a custom `displayName` property which equals
"Etcher" at the time of this writing.

This PR makes use of this property directly instead of hardcoding
"Etcher" in some places.
This commit is contained in:
Juan Cruz Viotti 2016-03-09 08:51:34 -04:00
parent fc6767b781
commit 3af8c6dd49
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,7 @@ const isElevated = require('is-elevated');
const sudoPrompt = require('sudo-prompt'); const sudoPrompt = require('sudo-prompt');
const os = require('os'); const os = require('os');
const platform = os.platform(); const platform = os.platform();
const packageJSON = require('../package.json');
exports.require = function(app, callback) { exports.require = function(app, callback) {
isElevated(function(error, elevated) { isElevated(function(error, elevated) {
@ -40,7 +41,7 @@ exports.require = function(app, callback) {
app.dock.hide(); app.dock.hide();
sudoPrompt.exec(process.argv.join(' '), { sudoPrompt.exec(process.argv.join(' '), {
name: 'Etcher' name: packageJSON.displayName
}, function(error) { }, function(error) {
if (error) { if (error) {
return callback(error); return callback(error);

View File

@ -19,6 +19,7 @@
const electron = require('electron'); const electron = require('electron');
const Bluebird = require('bluebird'); const Bluebird = require('bluebird');
const zipImage = require('resin-zip-image'); const zipImage = require('resin-zip-image');
const packageJSON = require('../../package.json');
/** /**
* @summary Open an image selection dialog * @summary Open an image selection dialog
@ -58,7 +59,7 @@ exports.selectImage = function() {
if (zipImage.isZip(file) && !zipImage.isValidZipImage(file)) { if (zipImage.isZip(file) && !zipImage.isValidZipImage(file)) {
electron.dialog.showErrorBox( electron.dialog.showErrorBox(
'Invalid zip image', 'Invalid zip image',
'Etcher can only open Zip archives that contain exactly one image file inside.' `${packageJSON.displayName} can only open Zip archives that contain exactly one image file inside.`
); );
return; return;