Closed do-web closed 4 years ago
According to the source of os-tmpdir
this could only happen if neither of the following environment variables are set: TEMP
, TMP
, SystemRoot
, and windir
.
Could you verify that for me please by dumping the process.env
.
The following should work:
console.log(JSON.stringify(process.env))
Could you please also show me what os.tmpdir()
says to you?
const os = require('os');
console.log(os.tmpdir());
This is working now: tmp.tmpNameSync({ dir: app.getPath('temp') })
Could you please provide the requested information, so we could make sure that tmp works in electron on your Windows platform too? Thank you!
@raszi I believe that tmp should fail early whenever it encounters an undefined tmpdir. What do you think?
@silkentrance I believe that is a good idea!
This was never fixed, at least not correctly.
It will also break with the changes for #207 and the way that the dir option is being treated, which can no longer be an absolute path outside of the system's default.
The correct behaviour should be for _getTmpDir() to throw an exception if the os.tmpDir() cannot be resolved as a path using path.resolve().
From the official electron docs https://www.electronjs.org/docs/all
Avoid platform-dependent code:
Use path.join() to concatenate filenames.
Use os.tmpdir() rather than /tmp when you need to reference the temporary directory.
So os.tmpdir() should be set and working around using app.getPath('temp') must not be used.
Operating System
NodeJS Version
Tmp Version
TBD:Enter tmp version here newest
Expected Behavior
TBD:What have you expected tmp to do? correct temp file.
Experienced Behavior
TBD:What did actually happen?
It generates this file:
Then i trying to write to this file: