Skip to content

Commit 00f494e

Browse files
author
Khanh Nguyen
committed
Fixed filesystem reading empty dir not resolving
1 parent ea7a93f commit 00f494e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

rules/.dummy

Whitespace-only changes.

src/common/file_system.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import fs from 'fs';
2-
import {join as joinPath} from 'path';
2+
import { join as joinPath } from 'path';
33
import mkdirp from 'mkdirp';
44

55
export default class FileSystem {
6-
constructor() {}
6+
constructor() { }
77

88
readDirectory(path) {
99
const self = this;
@@ -16,6 +16,10 @@ export default class FileSystem {
1616
let statCount = 0;
1717
let directoryIndex = self.getEmptyDirectoryIndex();
1818

19+
if (elements.length == 0) {
20+
resolve(directoryIndex);
21+
}
22+
1923
elements.forEach(function (element) {
2024
fs.stat(joinPath(path, element), function (error, stats) {
2125
if (stats.isDirectory()) {

0 commit comments

Comments
 (0)