From: Cheng Zhao Date: Thu, 5 Nov 2015 12:47:27 +0000 (+0800) Subject: win: Fix calling showItemInFolder in renderer process X-Git-Tag: v0.34.3~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=47649ffd179a67cd9e5462856da8ca94c92915d2;p=electron.git win: Fix calling showItemInFolder in renderer process --- 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())