mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-11 19:17:09 +03:00
Introduce getPlaceholderConfigFilePath()
to resolve failures within atom-application.js
This commit is contained in:
parent
03f2c30ee9
commit
8c309abbcb
@ -1,3 +1,6 @@
|
||||
// External modules must be imported within each function. As the context
|
||||
// (eg renderer or main process) is different depending on where these functions
|
||||
// are being called.
|
||||
|
||||
function getReleaseChannel(version) {
|
||||
// This matches stable, dev (with or without commit hash) and any other
|
||||
@ -46,8 +49,19 @@ function getConfigFilePath() {
|
||||
}
|
||||
}
|
||||
|
||||
function getPlaceholderConfigFilePath() {
|
||||
// This is only used when `./src/main-process/atom-application.js` initializes
|
||||
// the `ConfigFile` instance. Since it passes the config file path, without any
|
||||
// recovery logic for being unable to find it, we must provide a path to `ConfigFile`
|
||||
// even if incorrect. Instead of passing `null` on being unable to find the config.
|
||||
const path = require("path");
|
||||
|
||||
return path.join(process.env.ATOM_HOME, "config.cson");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getReleaseChannel,
|
||||
getAppName,
|
||||
getConfigFilePath,
|
||||
getPlaceholderConfigFilePath,
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ const ConfigFile = require('../config-file');
|
||||
const FileRecoveryService = require('./file-recovery-service');
|
||||
const StartupTime = require('../startup-time');
|
||||
const ipcHelpers = require('../ipc-helpers');
|
||||
const { getConfigFilePath } = require('../get-app-details.js');
|
||||
const { getConfigFilePath, getPlaceholderConfigFilePath } = require('../get-app-details.js');
|
||||
const {
|
||||
BrowserWindow,
|
||||
Menu,
|
||||
@ -208,7 +208,11 @@ module.exports = class AtomApplication extends EventEmitter {
|
||||
|
||||
this.initializeAtomHome(process.env.ATOM_HOME);
|
||||
|
||||
const configFilePath = getConfigFilePath();
|
||||
let configFilePath = getConfigFilePath();
|
||||
|
||||
if (configFilePath === null) {
|
||||
configFilePath = getPlaceholderConfigFilePath();
|
||||
}
|
||||
|
||||
this.configFile = ConfigFile.at(configFilePath);
|
||||
this.config = new Config({
|
||||
|
Loading…
Reference in New Issue
Block a user