Skip to content

Commit 264b40d

Browse files
author
repo-visualizer
committed
default path to ./ for fs methods
1 parent 86ecc39 commit 264b40d

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
@@ -12830,7 +12830,7 @@ var processDir = async (rootPath = "", excludedPaths = [], excludedGlobs = []) =
1283012830
const foldersToIgnore = [".git", ...excludedPaths];
1283112831
const fullPathFoldersToIgnore = new Set(foldersToIgnore.map((d2) => nodePath.join(rootPath, d2)));
1283212832
const getFileStats = async (path = "") => {
12833-
const stats = await import_fs.default.statSync(path);
12833+
const stats = await import_fs.default.statSync(path || "./");
1283412834
const name = path.split("/").filter(Boolean).slice(-1)[0];
1283512835
const size = stats.size;
1283612836
const relativePath = path.slice(rootPath.length + 1);
@@ -12842,9 +12842,9 @@ var processDir = async (rootPath = "", excludedPaths = [], excludedGlobs = []) =
1284212842
};
1284312843
const addItemToTree = async (path = "", isFolder = true) => {
1284412844
try {
12845-
console.log("Looking in ", path);
12845+
console.log("Looking in ", path || "./");
1284612846
if (isFolder) {
12847-
const filesOrFolders = await import_fs.default.readdirSync(path);
12847+
const filesOrFolders = await import_fs.default.readdirSync(path || "./");
1284812848
const children2 = [];
1284912849
for (const fileOrFolder of filesOrFolders) {
1285012850
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)