win: Fix calling showItemInFolder in renderer process
This commit is contained in:
parent
4ff5ce4d6d
commit
47649ffd17
2 changed files with 4 additions and 4 deletions
|
@ -1,5 +1 @@
|
||||||
module.exports = process.atomBinding 'shell'
|
module.exports = process.atomBinding 'shell'
|
||||||
|
|
||||||
if process.platform is 'win32' and process.type is 'renderer'
|
|
||||||
module.exports.showItemInFolder = (item) ->
|
|
||||||
require('remote').require('shell').showItemInFolder item
|
|
||||||
|
|
|
@ -203,6 +203,10 @@ HRESULT DeleteFileProgressSink::ResumeTimer() {
|
||||||
namespace platform_util {
|
namespace platform_util {
|
||||||
|
|
||||||
void ShowItemInFolder(const base::FilePath& full_path) {
|
void ShowItemInFolder(const base::FilePath& full_path) {
|
||||||
|
base::win::ScopedCOMInitializer com_initializer;
|
||||||
|
if (!com_initializer.succeeded())
|
||||||
|
return;
|
||||||
|
|
||||||
base::FilePath dir = full_path.DirName().AsEndingWithSeparator();
|
base::FilePath dir = full_path.DirName().AsEndingWithSeparator();
|
||||||
// ParseDisplayName will fail if the directory is "C:", it must be "C:\\".
|
// ParseDisplayName will fail if the directory is "C:", it must be "C:\\".
|
||||||
if (dir.empty())
|
if (dir.empty())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue