diff --git a/tools/files.js b/tools/files.js index 9993a14f98c..564a676bb95 100644 --- a/tools/files.js +++ b/tools/files.js @@ -1375,3 +1375,8 @@ files.pathwatcherWatch = function () { files.convertToStandardPath = convertToStandardPath; files.convertToOSPath = convertToOSPath; +<<<<<<< HEAD +======= +files.convertToPosixPath = toPosixPath; + +>>>>>>> Package.js:api.addFiles and Assets.get* accept both type of paths diff --git a/tools/package-source.js b/tools/package-source.js index db96064a3b6..92140feb9f2 100644 --- a/tools/package-source.js +++ b/tools/package-source.js @@ -1220,6 +1220,18 @@ _.extend(PackageSource.prototype, { paths = toArray(paths); arch = toArchArray(arch); + // Convert Dos-style paths to Unix-style paths. + // XXX it is possible to convert an already Unix-style path by mistake + // and break it. e.g.: 'some\folder/anotherFolder' is a valid path + // consisting of two components. #WindowsPathApi + paths = _.map(paths, function (p) { + if (p.indexOf('/') !== -1) { + // it is already a Unix-style path most likely + return p; + } + return files.convertToPosixPath(p, true); + }); + _.each(paths, function (path) { forAllMatchingArchs(arch, function (a) { var source = {relPath: path}; diff --git a/tools/server/boot.js b/tools/server/boot.js index a8cc49bf1c9..e7ae394e6de 100644 --- a/tools/server/boot.js +++ b/tools/server/boot.js @@ -170,6 +170,15 @@ Fiber(function () { console.log("Exception in callback of getAsset", e.stack); }); + // Convert a DOS-style path to Unix-style in case the application code was + // written on Windows. + // XXX note that we can't always correctly convert #WindowsPathApi + if (assetPath.indexOf('/') !== -1) { + // it is already a Unix-style path most likely + } else { + assetPath = assetPath.replace(/\\/g, '/'); + } + if (!fileInfo.assets || !_.has(fileInfo.assets, assetPath)) { _callback(new Error("Unknown asset: " + assetPath)); } else {