Skip to content

Commit d4f133c

Browse files
committed
rf: Uniformize bidsignore reading between web and Deno
1 parent 646abea commit d4f133c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/files/deno.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,14 @@ async function _readFileTree(
151151
*/
152152
export async function readFileTree(rootPath: string): Promise<FileTree> {
153153
const ignore = new FileIgnoreRules([])
154-
try {
155-
const ignoreFile = new BIDSFileDeno(
156-
rootPath,
157-
'.bidsignore',
158-
ignore,
159-
)
160-
ignore.add(await readBidsIgnore(ignoreFile))
161-
} catch (err) {
162-
if (err && typeof err === 'object' && !('code' in err && err.code === 'ENOENT')) {
163-
logger.error(`Failed to read '.bidsignore' file with the following error:\n${err}`)
154+
const tree = await _readFileTree(rootPath, '/', ignore)
155+
const bidsignore = tree.get('.bidsignore')
156+
if (bidsignore) {
157+
try {
158+
ignore.add(await readBidsIgnore(bidsignore as BIDSFile))
159+
} catch (err) {
160+
console.log(`Failed to read '.bidsignore' file with the following error:\n${err}`)
164161
}
165162
}
166-
return _readFileTree(rootPath, '/', ignore)
163+
return tree
167164
}

0 commit comments

Comments
 (0)