Reputation: 3072
I'm using Electron. When I fire shell.openItem(fullPath to folderA)
on button click it opens folder A in widow (correct).
But If I fire shell.openItem(fullPath to folderA)
again from different button. Instead of bringing already opened folder, it opening folder Ain new window.
Upvotes: 0
Views: 247
Reputation: 5531
Your question is actually an observation. Yes, openItem
works that way. (deep inside it calls ShellExecuteEx
with "explore" verb option, which works this way)
If you want consecutive calls to use the same window you can use openExternal
(which deep inside executes shell with "open" option, which works this way). It will keep the same window open until you don't navigate away
Tested with 6.0.1
const { shell } = require('electron')
setInterval(() => {
shell.openExternal(__dirname)
}, 5000)
Upvotes: 2