0 Replies Latest reply on Dec 17, 2014 2:14 PM by johnrellis

    Working around bogus top-level folders in catalog

    johnrellis Most Valuable Participant

      I have a catalog originally created on Mac and then moved to Windows, and it has two poison top-level folders that cause various SDK methods to fail.  For example, they cause catalog:setActiveSources({folder}) to have an assertion failure. 

       

      For one of the folders, folder:getPath() returns nil. For another of the folders, folder:getPath() returns a Windows UNC file path that doesn't exist. I discovered this heuristic for identifying these bogus folders:

       

      function isValidTopLevelFolder (folder)
          local success, f = LrTasks.pcall (function ()
              return catalog:getFolderByPath (folder:getPath ()) end)
          return success and f 
          end
      

       

      I've already provided this catalog to Becky Sowada of Adobe, following up on a bug report in the feedback forum. But I thought this work-around might be of usefulness to others someday.