Learning Electron I'd like to do some file processing after a drag and drop. On a Mac the equivalent for tmp is a $TMPDIR. Referencing the API documentation of app I was able to locate the app.getAppPath() which shows my path from a simple console log from main.js. Below app.getAppPath() there is getPath() but when I try app.getPath(temp):
let foobar = app.getAppPath("temp")
console.log(foobar)
I get an error in the console of:
ReferenceError: temp is not defined
Through my research I've read:
In Electron is there a built-in for the temp directory to work on all operating systems or a process to reference?
Even after referencing the string of:
console.log(`The temp path is: ${app.getAppPath("temp")}`)
it returns the same response as:
console.log(`The AppPath is: ${app.getAppPath()}`)
which is:
The temp path is: /Users/Grim/Documents/GitHub/electron-quick-start-boilerplate
The AppPath is: /Users/Grim/Documents/GitHub/electron-quick-start-boilerplate
and the above console.log tests have been added after letWindow.
app.getAppPath() doesn't take an argument.
For app.getPath(name), the argument should be the string "temp": app.getPath("temp").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With