diff options
Diffstat (limited to 'lib/compilers/WSL-CL.js')
-rw-r--r-- | lib/compilers/WSL-CL.js | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/compilers/WSL-CL.js b/lib/compilers/WSL-CL.js index 831a13fe5..654b0011c 100644 --- a/lib/compilers/WSL-CL.js +++ b/lib/compilers/WSL-CL.js @@ -28,8 +28,10 @@ // Don't run under Wine (obviously) // Translate compiler path from Unix mounted volume (/mnt/c/tmp) to Windows (c:/tmp) -var Compile = require('../base-compiler'); -var asm = require('../asm-cl'); +var Compile = require('../base-compiler'), + asm = require('../asm-cl'), + logger = require('../logger').logger, + temp = require('temp'); function compileCl(info, env) { var compile = new Compile(info, env); @@ -44,12 +46,24 @@ function compileCl(info, env) { // AP: Need to translate compiler paths from what the Node.js process sees // on a Unix mounted volume (/mnt/c/tmp) to what CL sees on Windows (c:/tmp) // We know process.env.tmpDir is of format /mnt/X/dir where X is drive letter. - var driveLetter = process.env.tmpDir.substring(5, 6); - var directoryPath = process.env.tmpDir.substring(7); + var driveLetter = process.env.winTmp.substring(5, 6); + var directoryPath = process.env.winTmp.substring(7); var windowsStyle = driveLetter.concat(":/", directoryPath); - return fn.replace(process.env.tmpDir, windowsStyle); + return fn.replace(process.env.winTmp, windowsStyle); }; } + // AP: Create CE temp directory in winTmp directory instead of the tmpDir directory. + // NPM temp package: https://www.npmjs.com/package/temp, see Affixes + compile.newTempDir = function () { + return new Promise(function (resolve, reject) { + temp.mkdir({prefix: 'compiler-explorer-compiler', dir: process.env.winTmp}, function (err, dirPath) { + if (err) + reject("Unable to open temp file: " + err); + else + resolve(dirPath); + }); + }); + }; compile.supportsObjdump = function () { return false; }; |