Skip to content

Commit

Permalink
Merge pull request #223 from luv2code/respect-tmpdir-env-var
Browse files Browse the repository at this point in the history
Respect tmpdir env var
  • Loading branch information
joethephish committed Jan 13, 2020
2 parents 1ce5846 + a761d2a commit 45bd2e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Inky-linux-x64
Inky_windows.zip
ReleaseUpload
app/renderer/documentation/
.idea/
16 changes: 8 additions & 8 deletions app/main-process/inklecate.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const child_process = require('child_process');
const exec = child_process.exec;
const spawn = child_process.spawn;
const fs = require('fs');
const path = require("path");
const electron = require('electron');
const ipc = electron.ipcMain;
const util = require('util');
const mkdirp = require('mkdirp');

// inklecate is packaged outside of the main asar bundle since it's executable
Expand All @@ -25,10 +23,12 @@ catch(e) {
inklecatePath = path.join(inklecateRootPathDev, inklecateNames[process.platform]);
}

// TODO: Customise this for different projects
// Is this the right temporary directory even on Mac? Seems like a bad practice
// to keep files around in a "public" place that the user might wish to keep private.
const tempInkPath = (process.platform == "darwin" || process.platform == "linux") ? "/tmp/inky_compile" : path.join(process.env.temp, "inky_compile");
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")
}

var sessions = {};

Expand Down Expand Up @@ -124,7 +124,7 @@ function compile(compileInstruction, requester) {
sessions[sessionId].ended = true;

sendAnyErrors();

if( code == 0 || code === undefined ) {
requester.send('inklecate-complete', sessionId, jsonExportPath);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ function compile(compileInstruction, requester) {
} else {
requester.send('play-generated-text', line, sessionId);
}

}

}
Expand Down

0 comments on commit 45bd2e2

Please sign in to comment.