mirror of
https://github.com/mathew-kurian/Scribe.js
synced 2025-09-17 22:21:12 +00:00
Fix + keep same format between dates and folder explorer
This commit is contained in:
parent
2607046cd5
commit
b603bbfc72
1 changed files with 18 additions and 9 deletions
|
@ -40,15 +40,19 @@
|
|||
*/
|
||||
var readDir = function (dirPath, callback) {
|
||||
|
||||
fs.readdir(dirPath, function (err, list) {
|
||||
var dir = [];
|
||||
if (!dirPath || typeof dirPath !== 'string') {
|
||||
callback("dirPath must be a string");
|
||||
} else {
|
||||
fs.readdir(dirPath, function (err, list) {
|
||||
var dir = [];
|
||||
|
||||
list.forEach(function (item) {
|
||||
dir.push(readNode(path.join(dirPath, item)));
|
||||
list.forEach(function (item) {
|
||||
dir.push(readNode(path.join(dirPath, item)));
|
||||
});
|
||||
|
||||
callback(null, dir);
|
||||
});
|
||||
|
||||
callback(null, dir);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -129,7 +133,7 @@
|
|||
|
||||
readDir(path, function (err, dir) {
|
||||
if (err) {
|
||||
res.status(500).end();
|
||||
res.status(400).end();
|
||||
} else {
|
||||
res.status(200).json(dir);
|
||||
}
|
||||
|
@ -172,7 +176,12 @@
|
|||
dates.forEach(function (date) {
|
||||
result.push({
|
||||
date : date,
|
||||
files : logWriter.history.dates[date]
|
||||
files : logWriter.history.dates[date].map(function (item) {
|
||||
return {
|
||||
name : path.basename(item),
|
||||
path : item
|
||||
};
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue