windows paths fixes to use / over \

This commit is contained in:
guybedford 2015-03-24 16:41:15 +02:00
parent 57f2b52612
commit 8a9d4f07e2
2 changed files with 7 additions and 0 deletions

View File

@ -70,6 +70,8 @@ function core(loader) {
if (typeof window == 'undefined' &&
typeof WorkerGlobalScope == 'undefined') {
baseURI = 'file:' + process.cwd() + '/';
if (isWindows)
baseURI = baseURI.replace(/\\/g, '/');
}
// Inside of a Web Worker
else if(typeof window == 'undefined') {

View File

@ -11,6 +11,8 @@ $__global.upgradeSystemLoader = function() {
return -1;
}
var isWindows = typeof process != 'undefined' && !!process.platform.match(/^win/);
// Absolute URL parsing, from https://gist.github.com/Yaffle/1088850
function parseURI(url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@\/?#]*(?::[^:@\/?#]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
@ -42,6 +44,9 @@ $__global.upgradeSystemLoader = function() {
return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
}
if (isWindows)
href = href.replace(/\\/g, '/');
href = parseURI(href || '');
base = parseURI(base || '');