Lightroom SDK: Add option to LrPathUtils.getStandardFilePath for "user prefs" (or equivalent functionality).

  • 3
  • Idea
  • Updated 5 years ago
As it stands (excerpt from api doc):

|> "the "appPrefs" selector will return the root of *Lightroom's* applications preferences folder, not the overall user preferences folder tree."

While having access to Lr's app-prefs dir is useful (thank you), there are times when a plugin needs to know where actual user-data will actually be, e.g. filename-templates, export presets...

Such user data may be with app-prefs or may be in subfolder of catalog, depending on Lr preference setting "Store user presets with this catalog".

I'd rather just have access to *all* Lr prefs, but if not, then an option to get path to actual user prefs (folder tree) would be appreciated.

Thanks for consideration,
Rob
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes

Posted 5 years ago

  • 3
Photo of John R. Ellis

John R. Ellis, Champion

  • 3870 Posts
  • 1023 Reply Likes
On Windows at least, the undocumented selector "adobeAppData" returns where the user's preferences are stored:



Here's an expanded list of possible selectors (haven't tried any of them on Mac):

adobeAppData
home
lightroomCommonFiles
desktop
documents
pictures
music
public_desktop
public_documents
public_music
public_pictures
public_videos
appData
cache
appPrefs
desktop
temp
allUserAppData
allUserAppDataACR
applications
applicationsX86
users
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes
Thanks John - good to know about the other (undocumented) possibilities. Sometime you'll have to let me in on the secret of how you figured those out ;-}.

Still, none do what I want, which is to have a different value returned depending on setting for Lr pref "Store presets with this catalog".
Photo of John R. Ellis

John R. Ellis, Champion

  • 3870 Posts
  • 1023 Reply Likes
Ah, I didn't read your post carefully enough. The SDK doesn't appear to expose the value of "Store presets with this catalog" directly, but here's a trick that should allow you to discover the actual folder location:

"Store presets with this catalog" enabled:


"Store presets with this catalog" disabled:
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes
You da man, man (again) :-).
~R.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 384 Reply Likes
Something like this will do it:

function Lightroom:computeActivePresetDir()
local presetFolders = LrApplication.developPresetFolders()
for i, v in ipairs( presetFolders ) do
if not v:getPath():find( "Adobe Photoshop Lightroom" ) then
return LrPathUtils.parent( LrPathUtils.parent( v:getPath() ) )
end
end
return nil, "Unable to obtain using develop preset folder path parsing"
end

i.e. make sure it's not pointing to a develop preset in with program files, then grandparent should be it.

PS - Production code should be more rigorous to protect from unexpected changes by Adobe..