|
@@ -141,7 +141,18 @@ if (nodeIntegration === 'true') {
|
|
|
|
|
|
// Set the __filename to the path of html file if it is file: protocol.
|
|
|
if (window.location.protocol === 'file:') {
|
|
|
- var pathname = process.platform === 'win32' && window.location.pathname[0] === '/' ? window.location.pathname.substr(1) : window.location.pathname
|
|
|
+ const location = window.location
|
|
|
+ let pathname = location.pathname
|
|
|
+
|
|
|
+ if (process.platform === 'win32') {
|
|
|
+ if (pathname[0] === '/') pathname = pathname.substr(1)
|
|
|
+
|
|
|
+ const isWindowsNetworkSharePath = location.hostname.length > 0 && globalPaths[0].startsWith('\\')
|
|
|
+ if (isWindowsNetworkSharePath) {
|
|
|
+ pathname = `//${location.host}/${pathname}`
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
global.__filename = path.normalize(decodeURIComponent(pathname))
|
|
|
global.__dirname = path.dirname(global.__filename)
|
|
|
|