From 41e86efda0be61ce97d994c8859b5e88b94aec26 Mon Sep 17 00:00:00 2001 From: "trop[bot]" Date: Thu, 25 Oct 2018 10:01:29 -0700 Subject: [PATCH] fix: folder open not working in devtools (#15396) --- brightray/browser/inspectable_web_contents_impl.cc | 3 ++- lib/renderer/inspector.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index eca8c2a64339..2954e428d66e 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -513,8 +513,9 @@ void InspectableWebContentsImpl::ShowItemInFolder( const std::string& file_system_path) { if (file_system_path.empty()) return; + base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); - platform_util::ShowItemInFolder(path); + platform_util::OpenItem(path); } void InspectableWebContentsImpl::SaveToFile(const std::string& url, diff --git a/lib/renderer/inspector.js b/lib/renderer/inspector.js index 3ff4180680f2..2565a6b6ae9a 100644 --- a/lib/renderer/inspector.js +++ b/lib/renderer/inspector.js @@ -2,10 +2,19 @@ window.onload = function () { // Use menu API to show context menu. window.InspectorFrontendHost.showContextMenuAtPoint = createMenu + // correct for Chromium returning undefined for filesystem + window.Persistence.FileSystemWorkspaceBinding.completeURL = completeURL + // Use dialog API to override file chooser dialog. window.UI.createFileSelectorElement = createFileSelectorElement } +// Extra / is needed as a result of MacOS requiring absolute paths +function completeURL (project, path) { + project = 'file:///' + return `${project}${path}` +} + window.confirm = function (message, title) { const {dialog} = require('electron').remote if (title == null) {