Closed steelbrain closed 8 years ago
Hi @steelbrain, I'd love to do this but I have a problem:
atom-linter
deletes the temporary file as soon as the supplied callback has run, meaning the temp files don't exist simultaneously and preventing the linking ability.Firstly, am I missing something with the tempfile helper that might allow me to do this?
If so, great. If not, would a tempfiles
helper be an acceptable addition to atom-linter
? This function would accept a list of filename/content pairs, write them as temp files, execute some callback and then delete them all. The tempfile
helper would then become a subset of this. I've attempted this here: https://github.com/AtomLinter/atom-linter/compare/master...andystanton:add-temp-files?expand=1
@andystanton The callback can provide a promise and then the helper would only delete the file when the promise has been resolved, and it already uses the filename we provide so the extension is not gonna be a problem. About creating multiple temp files at once, that's gonna be a bit tricky at the moment, You would have to do Path.dirname(tempFile)
and then write another file in that dir and unlink it on deactivate.
The diff you provided to solve this looks nice, Thanks for doing that! But you have modified lib/helpers.js
which is actually a babel compiled file of src/helpers.js
:stuck_out_tongue:
I've just released atom-linter@4.3.0
with the helper you proposed
Thanks @steelbrain I'll integrate the new helper with linter-glsl. Facepalm of my own at modifying the generated sources :)
Merged #18
Code looks much nicer now: https://github.com/andystanton/linter-glsl/commit/01e6b5ed52e29f18e7ea15640c3c6ca61ddc7fce
:+1:
^ taken from README
Example Usage: