listRoots.js 679 B

1234567891011121314151617181920212223242526
  1. requirelib("filelib");
  2. function folderContainSubFiles(filepath){
  3. var results = filelib.aglob(filepath + "/*", "default");
  4. if (results.length > 0){
  5. return true;
  6. }
  7. return false;
  8. }
  9. function main(){
  10. var possibleRoots = [];
  11. for ( var i = 0; i < USER_VROOTS.length; i++){
  12. var thisRoot = USER_VROOTS[i];
  13. if (thisRoot.Filesystem != "virtual" && filelib.fileExists(thisRoot.UUID + ":/Photo") && folderContainSubFiles(thisRoot.UUID + ":/Photo/")){
  14. possibleRoots.push([thisRoot.Name, thisRoot.UUID + ":/", thisRoot.UUID + ":/Photo"]);
  15. }else{
  16. }
  17. }
  18. sendJSONResp(JSON.stringify(possibleRoots));
  19. }
  20. main();