Skip to content

Commit

Permalink
abadon existsSync. Try and read bidsignore, if error thrown continue …
Browse files Browse the repository at this point in the history
…on does not exist
  • Loading branch information
rwblair committed Oct 8, 2024
1 parent 1960f96 commit bc01649
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bids-validator/src/files/deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Deno specific implementation for reading files
*/
import { basename, join } from '@std/path'
import { existsSync } from '@std/fs'
import * as posix from '@std/path/posix'
import { type BIDSFile, FileTree } from '../types/filetree.ts'
import { requestReadPermission } from '../setup/requestPermissions.ts'
Expand Down Expand Up @@ -150,13 +149,17 @@ async function _readFileTree(
*/
export async function readFileTree(rootPath: string): Promise<FileTree> {
const ignore = new FileIgnoreRules([])
if (existsSync(join(rootPath, '.bidsignore'))) {
try {
const ignoreFile = new BIDSFileDeno(
rootPath,
'.bidsignore',
ignore,
)
ignore.add(await readBidsIgnore(ignoreFile))
} catch (err) {
if (!(Object.hasOwn(err, 'code') && err.code === "ENOENT")) {
throw err
}

Check warning on line 162 in bids-validator/src/files/deno.ts

View check run for this annotation

Codecov / codecov/patch

bids-validator/src/files/deno.ts#L161-L162

Added lines #L161 - L162 were not covered by tests
}
return _readFileTree(rootPath, '/', ignore)
}

0 comments on commit bc01649

Please sign in to comment.