I'm working on an app that generates a report, giving you a "View folder" button to view the file within its folder once generated.
What is the best way in nw.js to focus explorer if that folder if open in explorer or open explorer if not?
I know I could open a new explorer window each time with something like
require('child_process').exec('start "" "c:\\MyPath"');
...but I'm not sure that's the best way. (If that's the way to go, I'm passing in a path variable like C:\MyPath and need to figure out how to escape \ as \\ etc. so that start will accept the path variable.)
Don't use child_process
, use the method built-in to NW.js: https://nwjs.readthedocs.io/en/latest/References/Shell/#shellshowiteminfolderfile_path