As mentioned in https://stackoverflow.com/a/32556337/103396, require('os').homedir()
is the way to get the user's home directory.
In Windows the desktop path would be on user_home_dir/Desktop
:
require('path').join(require('os').homedir(), 'Desktop')
Will this work on other platforms?
Sorry for the late reply.
Yes, it does work cross-platform. So far, I've tested it on Windows 10 and Ubuntu, both have positive results.
See:
Windows 10 Screenshot
Ubuntu Screenshot
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