Merge pull request #16 from makermelissa/main
Fix listDir bug returning empty lines
This commit is contained in:
commit
b96e9660ac
1 changed files with 9 additions and 8 deletions
3
repl.js
3
repl.js
|
|
@ -209,12 +209,12 @@ for item in contents:
|
||||||
print(item, result[0], result[6], result[9])
|
print(item, result[0], result[6], result[9])
|
||||||
`;
|
`;
|
||||||
const result = await this._repl.runCode(code);
|
const result = await this._repl.runCode(code);
|
||||||
|
|
||||||
let contents = [];
|
let contents = [];
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
for (let line of result.split("\n")) {
|
for (let line of result.split("\n")) {
|
||||||
|
if (line.length > 0) {
|
||||||
let [name, isDir, fileSize, fileDate] = line.split(" ");
|
let [name, isDir, fileSize, fileDate] = line.split(" ");
|
||||||
contents.push({
|
contents.push({
|
||||||
path: name,
|
path: name,
|
||||||
|
|
@ -223,6 +223,7 @@ for item in contents:
|
||||||
fileDate: parseInt(fileDate) * 1000,
|
fileDate: parseInt(fileDate) * 1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue