From fbf6660872ea7a7e35a38d496e5c3085dfc97cac Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 24 Feb 2018 17:26:10 -0500 Subject: [PATCH] create logs dir if not exists --- src/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 04a615687d..9565291527 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { app, BrowserWindow } from 'electron'; +import * as fs from 'fs'; import * as path from 'path'; import { DesktopMainMessagingService } from './services/desktopMainMessaging.service'; @@ -41,7 +42,12 @@ export class Main { if (appDataPath != null) { app.setPath('userData', appDataPath); } - app.setPath('logs', path.join(app.getPath('userData'), 'logs')); + + const logsDir = path.join(app.getPath('userData'), 'logs'); + if (!fs.existsSync(logsDir)) { + fs.mkdirSync(logsDir); + } + app.setPath('logs', logsDir); const args = process.argv.slice(1); const watch = args.some((val) => val === '--watch');