]> khamidou — GitHub mirrors - electron.git/commitdiff
win: Fix calling showItemInFolder in renderer process
authorCheng Zhao <zcbenz@gmail.com>
Thu, 5 Nov 2015 12:47:27 +0000 (20:47 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 5 Nov 2015 12:47:27 +0000 (20:47 +0800)
atom/common/api/lib/shell.coffee
atom/common/platform_util_win.cc

index bd7109e34518f23d72fc0bd089f9ccfb2248e620..5fb935bacd21097d5631790b65c4385ec3fe2323 100644 (file)
@@ -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
index 2ef8a0528088b32b8c47ddb8e818de42f904e091..87f45e5cb2d4c8123d1b142a43c721b822dcc68d 100644 (file)
@@ -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())