From f9bb83815f4464f337a49bc14750bcbf43679186 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 27 Sep 2016 13:24:21 -0700 Subject: [PATCH] Switch fs.statSync to fs.accessSync, which is faster --- src/config.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/config.js b/src/config.js index 7a2c7f94..01764fb3 100644 --- a/src/config.js +++ b/src/config.js @@ -147,12 +147,14 @@ function isPortable () { return false } - let portablePathExists = false try { - portablePathExists = !!fs.statSync(PORTABLE_PATH) - } catch (err) {} - - return portablePathExists + // This line throws if the "Portable Settings" folder does not exist, and does + // nothing otherwise. + fs.accessSync(PORTABLE_PATH, fs.constants.R_OK | fs.constants.W_OK) + return true + } catch (err) { + return false + } } function isProduction () {