From 47649ffd179a67cd9e5462856da8ca94c92915d2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 5 Nov 2015 20:47:27 +0800 Subject: [PATCH] win: Fix calling showItemInFolder in renderer process --- atom/common/api/lib/shell.coffee | 4 ---- atom/common/platform_util_win.cc | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/atom/common/api/lib/shell.coffee b/atom/common/api/lib/shell.coffee index bd7109e3..5fb935ba 100644 --- a/atom/common/api/lib/shell.coffee +++ b/atom/common/api/lib/shell.coffee @@ -1,5 +1 @@ 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 diff --git a/atom/common/platform_util_win.cc b/atom/common/platform_util_win.cc index 2ef8a052..87f45e5c 100644 --- a/atom/common/platform_util_win.cc +++ b/atom/common/platform_util_win.cc @@ -203,6 +203,10 @@ HRESULT DeleteFileProgressSink::ResumeTimer() { namespace platform_util { void ShowItemInFolder(const base::FilePath& full_path) { + base::win::ScopedCOMInitializer com_initializer; + if (!com_initializer.succeeded()) + return; + base::FilePath dir = full_path.DirName().AsEndingWithSeparator(); // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". if (dir.empty()) -- 2.43.0