From 8fc997be6adef61c82d4c2a1f073290175a53c04 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Thu, 12 Feb 2015 17:26:01 +0000 Subject: [PATCH] Use OS temp directory os.tmpdir() rather than hard-coded /tmp This makes it easier to use on operating systems (Windows) where /tmp does not exist (and is probably the right thing to do anyhow). --- lib/mj-page.js | 3 ++- lib/mj-single.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mj-page.js b/lib/mj-page.js index c84794ae..0e8d90b2 100644 --- a/lib/mj-page.js +++ b/lib/mj-page.js @@ -32,6 +32,7 @@ var fmt = require('util').format; var jsdom = require("jsdom").jsdom; var exec = require('child_process').exec; var speech = require('speech-rule-engine'); +var os = require('os'); var displayMessages = false; // don't log Message.Set() calls var displayErrors = true; // show error messages on the console @@ -81,7 +82,7 @@ var MathJax; // filled in once MathJax is loaded var serverState = STATE.STOPPED; // nothing loaded yet var timer; // used to reset MathJax if it runs too long -var tmpfile = "/tmp/mj-single-svg"; // file name prefix to use for temp files +var tmpfile = os.tmpdir() + "/mj-single-svg"; // file name prefix to use for temp files var document, window, content, html; // the DOM elements diff --git a/lib/mj-single.js b/lib/mj-single.js index 74b09fab..8e994ecd 100644 --- a/lib/mj-single.js +++ b/lib/mj-single.js @@ -33,6 +33,7 @@ var fmt = require('util').format; var jsdom = require('jsdom').jsdom; var exec = require('child_process').exec; var speech = require('speech-rule-engine'); +var os = require('os'); var displayMessages = false; // don't log Message.Set() calls var displayErrors = true; // show error messages on the console @@ -79,7 +80,7 @@ var MathJaxConfig; // configuration for when starting MathJax var MathJax; // filled in once MathJax is loaded var serverState = STATE.STOPPED; // nothing loaded yet var timer; // used to reset MathJax if it runs too long -var tmpfile = "/tmp/mj-single-svg"; // file name prefix to use for temp files +var tmpfile = os.tmpdir() + "/mj-single-svg"; // file name prefix to use for temp files var document, window, content, html; // the DOM elements