Fix listDir bug returning empty lines
This commit is contained in:
parent
538bc86bad
commit
db6e36dae0
1 changed files with 9 additions and 8 deletions
17
repl.js
17
repl.js
|
|
@ -209,19 +209,20 @@ 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")) {
|
||||||
let [name, isDir, fileSize, fileDate] = line.split(" ");
|
if (line.length > 0) {
|
||||||
contents.push({
|
let [name, isDir, fileSize, fileDate] = line.split(" ");
|
||||||
path: name,
|
contents.push({
|
||||||
isDir: isDir == TYPE_DIR,
|
path: name,
|
||||||
fileSize: parseInt(fileSize),
|
isDir: isDir == TYPE_DIR,
|
||||||
fileDate: parseInt(fileDate) * 1000,
|
fileSize: parseInt(fileSize),
|
||||||
});
|
fileDate: parseInt(fileDate) * 1000,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue