diff --git a/lib/index.js b/lib/index.js index f11ed47..faabee4 100755 --- a/lib/index.js +++ b/lib/index.js @@ -115,7 +115,8 @@ function saveSessionForDisplayToDb(sessionToHandle, connectedDisplaysId, windowL // check if entry exists and update db.get(sessionToHandle, (err, sessionData) => { if (err) { - reject(err); + // NOTE: we're not failing because, the case is probably that there is no session file yet + console.log(`saveSessionForDisplayToDb: no session file present yet for "${sessionToHandle}", creating a new one...`); } if (!sessionData) { diff --git a/lib/utility.js b/lib/utility.js index 78e7846..0316521 100644 --- a/lib/utility.js +++ b/lib/utility.js @@ -59,9 +59,9 @@ function mkdirSync(dirPath) { } } -function mkfileSync(dirPath) { +function mkfileSync(filePath) { try { - fs.mkdirSync(dirPath); + fs.writeFileSync(filePath, { flag: 'wx' }); } catch (err) { if (err.code !== 'EEXIST') { throw err;