From d5ead799cec66385878995ef3772425b5da5f758 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 14 Jun 2018 13:39:44 -0700 Subject: [PATCH] Follow symlinks in app/config paths before starting app up --- main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 6c7bbdf31305..c76474c8acb5 100644 --- a/main.js +++ b/main.js @@ -1,10 +1,14 @@ const path = require('path'); const url = require('url'); const os = require('os'); +const fs = require('fs'); const _ = require('lodash'); +const pify = require('pify'); const electron = require('electron'); +const getRealPath = pify(fs.realpath); + const { app, BrowserWindow, @@ -440,9 +444,9 @@ function showAbout() { // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. let ready = false; -app.on('ready', () => { - const userDataPath = app.getPath('userData'); - const installPath = app.getAppPath(); +app.on('ready', async () => { + const userDataPath = await getRealPath(app.getPath('userData')); + const installPath = await getRealPath(app.getAppPath()); if (process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'test-lib') { installFileHandler({