pspeter3/typescript-register

Not enough crossplatform way of defining temporary directory

Closed this issue · 1 comments

Currently the cache path is defined as

outDir: path.join(path.sep, "tmp", "typescript-register", process.cwd()),

That totally won't work on Windows and I have issues with that. For example, if my project is placed in D:\Projects\memhub, tsc complains: 'Could not write file \'\\tmp\\typescript-register\\D:\\Projects\\memhub/gulpfile.js\': ENOENT, no such file or directory \'D:\\tmp\\typescript-register\\D:\''

And even worse - it creates tmp directory at the root of my drive.

I'd suggest to replace it with process.env.TEMP combined with process.cwd() processed by sanitize-filename or something alike.

That sounds good to me. I wasn't thinking about Windows when I wrote this beyond path.join. My apologies.