Skip to content

Commit e30bbb1

Browse files
author
repo-visualizer
committed
ensure paths are relative in fs methods
1 parent 35d3bd0 commit e30bbb1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12832,7 +12832,7 @@ var processDir = async (rootPath = "", excludedPaths = [], excludedGlobs = []) =
1283212832
const foldersToIgnore = [".git", ...excludedPaths];
1283312833
const fullPathFoldersToIgnore = new Set(foldersToIgnore.map((d2) => nodePath.join(rootPath, d2)));
1283412834
const getFileStats = async (path = "") => {
12835-
const stats = await import_fs.default.statSync(path || "./");
12835+
const stats = await import_fs.default.statSync(`./${path}`);
1283612836
const name = path.split("/").filter(Boolean).slice(-1)[0];
1283712837
const size = stats.size;
1283812838
const relativePath = path.slice(rootPath.length + 1);
@@ -12844,9 +12844,9 @@ var processDir = async (rootPath = "", excludedPaths = [], excludedGlobs = []) =
1284412844
};
1284512845
const addItemToTree = async (path = "", isFolder = true) => {
1284612846
try {
12847-
console.log("Looking in ", path || "./");
12847+
console.log("Looking in ", `./${path}`);
1284812848
if (isFolder) {
12849-
const filesOrFolders = await import_fs.default.readdirSync(path || "./");
12849+
const filesOrFolders = await import_fs.default.readdirSync(`./${path}`);
1285012850
const children2 = [];
1285112851
for (const fileOrFolder of filesOrFolders) {
1285212852
const fullPath = nodePath.join(rootPath, fileOrFolder);

src/process-dir.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const processDir = async (rootPath = "", excludedPaths = [], excludedGlob
1111

1212

1313
const getFileStats = async (path = "") => {
14-
const stats = await fs.statSync(path || "./");
14+
const stats = await fs.statSync(`./${path}`);
1515
const name = path.split("/").filter(Boolean).slice(-1)[0];
1616
const size = stats.size;
1717
const relativePath = path.slice(rootPath.length + 1);
@@ -26,10 +26,10 @@ export const processDir = async (rootPath = "", excludedPaths = [], excludedGlob
2626
isFolder = true,
2727
) => {
2828
try {
29-
console.log("Looking in ", path || "./");
29+
console.log("Looking in ", `./${path}`);
3030

3131
if (isFolder) {
32-
const filesOrFolders = await fs.readdirSync(path || "./");
32+
const filesOrFolders = await fs.readdirSync(`./${path}`);
3333
const children = [];
3434

3535
for (const fileOrFolder of filesOrFolders) {

0 commit comments

Comments
 (0)