Skip to content

Commit

Permalink
web build did not like fs import at top of src/files/deno. Conditiona…
Browse files Browse the repository at this point in the history
…lly load library. Maybe better off just attempting text call and seeing if it errors out.
  • Loading branch information
rwblair committed Oct 8, 2024
1 parent bda843a commit c02e1f0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 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,16 @@ async function _readFileTree(
*/
export async function readFileTree(rootPath: string): Promise<FileTree> {
const ignore = new FileIgnoreRules([])
if (existsSync(join(rootPath, '.bidsignore'))) {
const ignoreFile = new BIDSFileDeno(
rootPath,
'.bidsignore',
ignore,
)
ignore.add(await readBidsIgnore(ignoreFile))
if (globalThis.Deno) {
import { existsSync } from '@std/fs'
if (existsSync(join(rootPath, '.bidsignore'))) {
const ignoreFile = new BIDSFileDeno(
rootPath,
'.bidsignore',
ignore,
)
ignore.add(await readBidsIgnore(ignoreFile))
}
}
return _readFileTree(rootPath, '/', ignore)
}

0 comments on commit c02e1f0

Please sign in to comment.