diff --git a/test.js b/test.js index 7a7f198..7af948e 100644 --- a/test.js +++ b/test.js @@ -1211,6 +1211,33 @@ describe('gulp-rev-all', function () { }); + if (/^win/.test(process.platform)) { + it('windows path', function () { + + var base = 'c:\\first\\second'; + + var file = new Gutil.File({ + path: 'c:\\first\\second\\third\\index.html', + base: base + }); + + var fileReference = new Gutil.File({ + path: 'c:\\first\\second\\third\\fourth\\other.html', + base: base + }); + + file.revPathOriginal = file.path; + fileReference.revPathOriginal = fileReference.path; + + var references = Tool.get_reference_representations_relative(fileReference, file); + + references.length.should.equal(2); + references[0].should.equal('fourth/other.html'); + references[1].should.equal('./fourth/other.html'); + + }); + } + }); describe('should resolve references that have 1 traversals', function () { diff --git a/tool.js b/tool.js index e571d21..c7f0e44 100644 --- a/tool.js +++ b/tool.js @@ -10,7 +10,7 @@ module.exports = (function() { }; var dirname_with_sep = function(path) { - return Path.dirname(path) + '/'; + return Path.dirname(path).replace(/\\/g, '/') + '/'; } var join_path_url = function (prefix, path) {