Comparing version 1.0.4 to 1.0.5
@@ -18,3 +18,3 @@ "use strict"; | ||
return { | ||
root: root, | ||
root: path.normalize(root), | ||
prefix: tree.prefix || prefix, | ||
@@ -62,6 +62,7 @@ getDestinationPath: tree.getDestinationPath || getDestinationPath | ||
let { basePath } = options || {}; | ||
basePath = basePath && path.normalize(basePath); | ||
if (this.MAP[basePath]) { | ||
let { root, prefix, getDestinationPath } = this.MAP[basePath]; | ||
return { | ||
path: root + '/' + filePath, | ||
path: path.join(root, filePath), | ||
prefix: prefix, | ||
@@ -75,3 +76,3 @@ getDestinationPath: getDestinationPath | ||
return { | ||
path: root + '/' + filePath, | ||
path: path.join(root, filePath), | ||
prefix: prefix, | ||
@@ -81,3 +82,3 @@ getDestinationPath: getDestinationPath | ||
} | ||
let fullPath = root + '/' + filePath; | ||
let fullPath = path.join(root, filePath); | ||
if(fs.existsSync(fullPath)) { | ||
@@ -84,0 +85,0 @@ result = { |
{ | ||
"name": "fs-merger", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Reads files from a real location", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,2 +6,3 @@ "use strict"; | ||
const rm = require('rimraf').sync; | ||
const path = require('path'); | ||
@@ -78,3 +79,3 @@ describe('fs-reader', function () { | ||
expect(meta).to.eql({ | ||
path: 'fixtures/test-1/x.txt', | ||
path: path.normalize('fixtures/test-1/x.txt'), | ||
prefix: '', | ||
@@ -87,3 +88,3 @@ getDestinationPath: undefined, | ||
expect(meta).to.eql({ | ||
path: 'fixtures/test-2/c.txt', | ||
path: path.normalize('fixtures/test-2/c.txt'), | ||
prefix: 'test-2', | ||
@@ -96,3 +97,3 @@ getDestinationPath: undefined, | ||
expect(meta).to.eql({ | ||
path: 'fixtures/test-3/d.txt', | ||
path: path.normalize('fixtures/test-3/d.txt'), | ||
prefix: '', | ||
@@ -102,2 +103,10 @@ getDestinationPath: undefined, | ||
}); | ||
it('correct meta when basePath is provided', function () { | ||
let meta = fs.readFileMeta('d.txt', { basePath: 'fixtures/test-3'}) | ||
expect(meta).to.eql({ | ||
path: path.normalize('fixtures/test-3/d.txt'), | ||
prefix: '', | ||
getDestinationPath: undefined, | ||
}) | ||
}); | ||
}); | ||
@@ -104,0 +113,0 @@ describe('Reads contents of the folder from location', function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11925
6
286