mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix whitespace in localfilesystem
This commit is contained in:
parent
c8d6693fba
commit
f0a4ea099c
@ -333,56 +333,56 @@ var localfilesystem = {
|
|||||||
var root = fspath.join(libDir,type);
|
var root = fspath.join(libDir,type);
|
||||||
var rootPath = fspath.join(libDir,type,path);
|
var rootPath = fspath.join(libDir,type,path);
|
||||||
|
|
||||||
// don't create the folder if it does not exist - we are only reading....
|
// don't create the folder if it does not exist - we are only reading....
|
||||||
return nodeFn.call(fs.lstat, rootPath).then(function(stats) {
|
return nodeFn.call(fs.lstat, rootPath).then(function(stats) {
|
||||||
if (stats.isFile()) {
|
if (stats.isFile()) {
|
||||||
return getFileBody(root,path);
|
return getFileBody(root,path);
|
||||||
}
|
}
|
||||||
if (path.substr(-1) == '/') {
|
if (path.substr(-1) == '/') {
|
||||||
path = path.substr(0,path.length-1);
|
path = path.substr(0,path.length-1);
|
||||||
}
|
}
|
||||||
return nodeFn.call(fs.readdir, rootPath).then(function(fns) {
|
return nodeFn.call(fs.readdir, rootPath).then(function(fns) {
|
||||||
var dirs = [];
|
var dirs = [];
|
||||||
var files = [];
|
var files = [];
|
||||||
fns.sort().filter(function(fn) {
|
fns.sort().filter(function(fn) {
|
||||||
var fullPath = fspath.join(path,fn);
|
var fullPath = fspath.join(path,fn);
|
||||||
var absoluteFullPath = fspath.join(root,fullPath);
|
var absoluteFullPath = fspath.join(root,fullPath);
|
||||||
if (fn[0] != ".") {
|
if (fn[0] != ".") {
|
||||||
var stats = fs.lstatSync(absoluteFullPath);
|
var stats = fs.lstatSync(absoluteFullPath);
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
dirs.push(fn);
|
dirs.push(fn);
|
||||||
} else {
|
} else {
|
||||||
var meta = getFileMeta(root,fullPath);
|
var meta = getFileMeta(root,fullPath);
|
||||||
meta.fn = fn;
|
meta.fn = fn;
|
||||||
files.push(meta);
|
files.push(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return dirs.concat(files);
|
return dirs.concat(files);
|
||||||
});
|
});
|
||||||
}).otherwise(function(err) {
|
}).otherwise(function(err) {
|
||||||
// if path is empty, then assume it was a folder, return empty
|
// if path is empty, then assume it was a folder, return empty
|
||||||
if (path === ""){
|
if (path === ""){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// if path ends with slash, it was a folder
|
// if path ends with slash, it was a folder
|
||||||
// so return empty
|
// so return empty
|
||||||
if (path.substr(-1) == '/') {
|
if (path.substr(-1) == '/') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// else path was specified, but did not exist,
|
// else path was specified, but did not exist,
|
||||||
// check for path.json as an alternative if flows
|
// check for path.json as an alternative if flows
|
||||||
if (type === "flows" && !/\.json$/.test(path)) {
|
if (type === "flows" && !/\.json$/.test(path)) {
|
||||||
return localfilesystem.getLibraryEntry(type,path+".json")
|
return localfilesystem.getLibraryEntry(type,path+".json")
|
||||||
.otherwise(function(e) {
|
.otherwise(function(e) {
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
saveLibraryEntry: function(type,path,meta,body) {
|
saveLibraryEntry: function(type,path,meta,body) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user