diff --git a/bids-validator/src/files/deno.ts b/bids-validator/src/files/deno.ts index 346d7f07f..1e00002cf 100644 --- a/bids-validator/src/files/deno.ts +++ b/bids-validator/src/files/deno.ts @@ -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' @@ -150,13 +149,17 @@ async function _readFileTree( */ export async function readFileTree(rootPath: string): Promise { 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 + } } return _readFileTree(rootPath, '/', ignore) }