Skip to content

Commit

Permalink
Use a unique temporary directory every run
Browse files Browse the repository at this point in the history
closes inkle#369
  • Loading branch information
Oliver Jeeves committed Oct 3, 2021
1 parent c147fbd commit 870c684
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/main-process/inklecate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const child_process = require('child_process');
const spawn = child_process.spawn;
const fs = require('fs');
const os = require('os');
const path = require("path");
const electron = require('electron');
const ipc = electron.ipcMain;
Expand All @@ -24,11 +25,14 @@ catch(e) {
}

var tempInkPath;
if (process.platform == "darwin" || process.platform == "linux") {
tempInkPath = process.env.TMPDIR ? path.join(process.env.TMPDIR, "inky_compile") : "/tmp/inky_compile";
} else {
tempInkPath = path.join(process.env.temp, "inky_compile")
}
const tmpDir = os.tmpdir();
fs.mkdtemp(`${tmpDir}${path.sep}inky_compile_`, (err, folder) => {
if (err) {
throw new Error(err);
}

tempInkPath = folder;
})

var sessions = {};

Expand Down

0 comments on commit 870c684

Please sign in to comment.