From d89ec001220af03a204986c53de79a28a59e4b20 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 31 Jan 2019 17:30:34 -0800 Subject: [PATCH] fix(ppfox): check directory existance if necessary when running tests (#3871) --- experimental/puppeteer-firefox/misc/install-preferences.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/experimental/puppeteer-firefox/misc/install-preferences.js b/experimental/puppeteer-firefox/misc/install-preferences.js index b00f574400e..f664bfe10ba 100644 --- a/experimental/puppeteer-firefox/misc/install-preferences.js +++ b/experimental/puppeteer-firefox/misc/install-preferences.js @@ -16,8 +16,10 @@ async function installFirefoxPreferences(executablePath) { prefPath = path.join(firefoxFolder, '..', 'Resources', 'defaults', 'pref'); configPath = path.join(firefoxFolder, '..', 'Resources'); } else if (os.platform() === 'linux') { - await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults')); - await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults', 'preferences')); + if (!fs.existsSync(path.join(firefoxFolder, 'browser', 'defaults'))) + await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults')); + if (!fs.existsSync(path.join(firefoxFolder, 'browser', 'defaults', 'preferences'))) + await mkdirAsync(path.join(firefoxFolder, 'browser', 'defaults', 'preferences')); prefPath = path.join(firefoxFolder, 'browser', 'defaults', 'preferences'); configPath = firefoxFolder; } else if (os.platform() === 'win32') {