Files
atom/src/get-app-name.js
Rafael Oleza f0a4dcd46b Make get-app-name module compatible with the renderer process
This module is required both from the main process and the renderer
process, since `win-shell.js` is also required from both processes
(which is nuts).

In order to make it work when used from the main process, `get-app-name`
just falls back to use the `atom-environment` `getAppName()` method.
2019-07-04 15:21:32 +02:00

20 lines
493 B
JavaScript

const { app } = require('electron');
const getReleaseChannel = require('./get-release-channel');
module.exports = function getAppName() {
if (process.type === 'renderer') {
return atom.getAppName();
}
const releaseChannel = getReleaseChannel(app.getVersion());
const appNameParts = [app.getName()];
if (releaseChannel !== 'stable') {
appNameParts.push(
releaseChannel.charAt(0).toUpperCase() + releaseChannel.slice(1)
);
}
return appNameParts.join(' ');
};