diff --git a/app/browser/menu.js b/app/browser/menu.js index 69b13ad31e7..8d6b175de57 100644 --- a/app/browser/menu.js +++ b/app/browser/menu.js @@ -13,6 +13,7 @@ const messages = require('../../js/constants/messages') const settings = require('../../js/constants/settings') const dialog = electron.dialog const appActions = require('../../js/actions/appActions') +const { fileUrl } = require('../../js/lib/appUrlUtil') const menuUtil = require('./lib/menuUtil') const getSetting = require('../../js/settings').getSetting const locale = require('../locale') @@ -44,7 +45,7 @@ const createFileSubmenu = (CommonMenu) => { }, (paths) => { if (paths) { paths.forEach((path) => { - CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, path]) + CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, fileUrl(path)]) }) } }) diff --git a/js/lib/appUrlUtil.js b/js/lib/appUrlUtil.js index 285660cbce6..2e0adf7ae2f 100644 --- a/js/lib/appUrlUtil.js +++ b/js/lib/appUrlUtil.js @@ -7,7 +7,7 @@ const path = require('path') const UrlUtil = require('./urlutil') const config = require('../constants/config') -function fileUrl (str) { +module.exports.fileUrl = (str) => { var pathName = path.resolve(str).replace(/\\/g, '/') // Windows drive letter must be prefixed with a slash @@ -43,8 +43,8 @@ module.exports.getExtensionsPath = function (extensionDir) { module.exports.getIndexHTML = function () { return process.env.NODE_ENV === 'development' - ? fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index-dev.html') - : fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index.html') + ? module.exports.fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index-dev.html') + : module.exports.fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index.html') } /**