Skip to content

Commit

Permalink
fix: fix path seperator in symlink detection
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Aug 25, 2020
1 parent 8fc0540 commit 3898ed5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/file_system.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FileSystem {
const onlySymlinks = {}
for (const fullPath in symlinks) {
if (symlinks[fullPath]) {
const relativeToRepoPath = path.relative(this.targetDir, fullPath)
const relativeToRepoPath = path.relative(this.targetDir, fullPath).split(path.sep).join('/')
onlySymlinks[relativeToRepoPath] = true
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ class FileSystem {
shouldInclude (filePath) {
if (this.filterPaths.length === 0) { return true }
const resolvedPath = path.relative(this.targetDir, path.resolve(this.targetDir, filePath))
return this.filterPaths.some(p => resolvedPath.startsWith(path.normalize(p)))
return this.filterPaths.some(p => resolvedPath.startsWith(p))
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/lib/file_system_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ const expect = chai.expect
const realFs = require('fs')

describe('lib', () => {
describe('file_system', () => {
describe('file_system', function () {
const FileSystem = require('../../lib/file_system')

this.timeout(10000)

describe('fileExists', () => {
it('should return pass if the file exists', async () => {
const index = 'text_file_for_test.txt'
Expand Down

0 comments on commit 3898ed5

Please sign in to comment.