mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
чтобы в log не было много записей listObjects error
git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/nodeJSProjects@64971 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander.Trofimov
parent
1b2e53376d
commit
5f019d5557
@ -75,17 +75,27 @@ function* walkDir(fsPath, results, optNoSubDir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.listObjects = function(fsPath, optNoSubDir) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
exports.listObjects = function (fsPath, optNoSubDir) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
exports.spawn(function* () {
|
||||
try {
|
||||
var list;
|
||||
var stats = yield fsStat(fsPath);
|
||||
if (stats.isDirectory()) {
|
||||
list = [];
|
||||
yield* walkDir(fsPath, list, optNoSubDir);
|
||||
var stats;
|
||||
try {
|
||||
stats = yield fsStat(fsPath);
|
||||
} catch (e) {
|
||||
//exception if fsPath not exist
|
||||
stats = null;
|
||||
}
|
||||
if (stats) {
|
||||
if (stats.isDirectory()) {
|
||||
list = [];
|
||||
yield* walkDir(fsPath, list, optNoSubDir);
|
||||
} else {
|
||||
list = [fsPath];
|
||||
}
|
||||
} else {
|
||||
list = [fsPath];
|
||||
list = [];
|
||||
}
|
||||
resolve(list);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user