Lightroom SDK: LrApplication.developPresetFolders() returns buggy fake folders

  • 7
  • Problem
  • Updated 1 week ago
  • Solved
In LR 7.5, the array returned by LrLrApplication.developPresetFolders() includes buggy fake folder objects intended to represent separator rows in the user interface.  Invoking folder:getPath() on one of these bogus objects raises the internal error:
?:0: attempt to index field '_pathForFolder' (a nil value)
This affects any plugin that attempts to access the develop preset folders. In particular, it broke a DxO plugin and my own Fix Presets plugin (which fixes many other preset bugs):

https://forums.adobe.com/thread/2528220
https://feedback.dxo.com/t/export-to-dxo-broken-after-update-to-lr-7-5/4514
https://forums.adobe.com/thread/2527232
http://www.johnrellis.com/lightroom/fixpresets.htm

The workaround is to detect such bogus objects by calling folder:getPath() and trapping any error with pcall().

Details:

Here are the results of calling folder:getName() on the array of preset folders:



Note that the bogusly named folders correspond to the presence of separate rows in Develop's Preset panel.

Here's the result of calling folder:getPath() on the second (bogus) array element:





Photo of John R. Ellis

John R. Ellis, Champion

  • 3871 Posts
  • 1023 Reply Likes

Posted 3 months ago

  • 7
Photo of Chinoy Gupta

Chinoy Gupta, Employee

  • 50 Posts
  • 19 Reply Likes
Official Response
Hi John,

Thanks for reporting this. It is indeed a bug in 7.5 and we will fix it in next release. In the meanwhile, as you mentioned you can use pcall to trap the error or you can skip any folder name with value "__@@ThisIsASeparatorRow@@__".

Thanks,
Chinoy
Photo of Rikk Flohr

Rikk Flohr, Official Rep

  • 4291 Posts
  • 819 Reply Likes
Official Response
Greetings, 

The Lightroom Classic CC was updated today and contains a fix for this issue. Please download the new version and give it a try and let us know how it works.