Lightroom SDK: folder:getChildren() incorrectly returning 0 return values

  • 1
  • Problem
  • Updated 4 years ago
  • Acknowledged
On one of my catalogs, folder:getChildren() is returning 0 return values for a particular folder (that is, it is executing a "return;" statement, with no value):

I've optimized the catalog to no effect.

If I hide the root folder "/", then the method works correctly.

This may be related to these topics (or it may not):
http://feedback.photoshop.com/photosh...
http://feedback.photoshop.com/photosh...
Photo of John R. Ellis

John R. Ellis, Champion

  • 3690 Posts
  • 963 Reply Likes

Posted 4 years ago

  • 1
Photo of Paul Kleczka

Paul Kleczka, Employee

  • 44 Posts
  • 5 Reply Likes
Official Response
Try getting the first sub-folder by path and then using that folder. That worked for me. So...

local root = catalog:getFolders()[1]
local rootName = root:getName()

local subFolder = root:getChildren()[1]
local subFolderName = subFolder:getName()

local subFolderByPath = catalog:getFolderByPath(subFolder:getPath())

local subSubFolder = subFolderByPath:getChildren()[1]
local subSubFolderName = subSubFolder:getName()