win: Fix calling showItemInFolder in renderer process

This commit is contained in:
Cheng Zhao 2015-11-05 20:47:27 +08:00
parent 4ff5ce4d6d
commit 47649ffd17
2 changed files with 4 additions and 4 deletions

View 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

View 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())