fix: folder open not working in devtools (#15396)

This commit is contained in:
trop[bot] 2018-10-25 10:01:29 -07:00 committed by Shelley Vohr
parent 88b1f7d9c8
commit 41e86efda0
2 changed files with 11 additions and 1 deletions

View file

@ -513,8 +513,9 @@ void InspectableWebContentsImpl::ShowItemInFolder(
const std::string& file_system_path) { const std::string& file_system_path) {
if (file_system_path.empty()) if (file_system_path.empty())
return; return;
base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path);
platform_util::ShowItemInFolder(path); platform_util::OpenItem(path);
} }
void InspectableWebContentsImpl::SaveToFile(const std::string& url, void InspectableWebContentsImpl::SaveToFile(const std::string& url,

View file

@ -2,10 +2,19 @@ window.onload = function () {
// Use menu API to show context menu. // Use menu API to show context menu.
window.InspectorFrontendHost.showContextMenuAtPoint = createMenu window.InspectorFrontendHost.showContextMenuAtPoint = createMenu
// correct for Chromium returning undefined for filesystem
window.Persistence.FileSystemWorkspaceBinding.completeURL = completeURL
// Use dialog API to override file chooser dialog. // Use dialog API to override file chooser dialog.
window.UI.createFileSelectorElement = createFileSelectorElement 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) { window.confirm = function (message, title) {
const {dialog} = require('electron').remote const {dialog} = require('electron').remote
if (title == null) { if (title == null) {