Skip to content

Commit

Permalink
Fix cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Mar 28, 2024
1 parent 8294a45 commit 699aa94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@cross/dir": "jsr:@cross/dir@^1.1.0",
"@cross/runtime": "jsr:@cross/runtime@^1.0.0",
"@cross/test": "jsr:@cross/test@^0.0.9",
"@cross/utils": "jsr:@cross/utils@^0.8.2",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/path": "jsr:@std/path@^0.221.0"
},
Expand Down
7 changes: 5 additions & 2 deletions src/stat/find.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { readdir } from "node:fs/promises";
import { stat } from "./mod.ts";
import type { StatResult } from "./mod.ts";
import { join, resolve } from "@std/path";
import { isAbsolute, join, resolve } from "@std/path";
import { cwd } from "@cross/utils/cwd";

/**
* Recursively finds files and directories within a specified path, optionally applying advanced filtering.
Expand Down Expand Up @@ -33,7 +34,9 @@ export async function find(
recursive: boolean = true,
): Promise<string[]> {
const statSelf = await stat(inPath);
const resolvedPath = resolve(inPath);
const resolvedPath = isAbsolute(inPath)
? resolve(inPath)
: resolve(cwd(), inPath);
if (statSelf.isFile || statSelf.isSymlink) {
if (!fileFilter || fileFilter(resolvedPath, statSelf)) {
return [resolvedPath]; // Return the file path directly
Expand Down

0 comments on commit 699aa94

Please sign in to comment.