Copy link to clipboard
Copied
We need to be able to identify whether a specific creative profile has been imported into LrC.
I know that we can see presets, but are we able to see creative profiles in the same way?
Does the SDK provide this option?
The only option I can think of is looping all files below the CameraRaw directory looking for a <profile name>.xmp file.
Unfortunately, when enhanced profiles were added to LR 7.3, they weren't added to the SDK.
I think your only option is to examine the various settings folders for .xmp files and use LrXml to read the contents of each .xmp file to determine its name (as displayed in LR) and its type (develop preset or enhanced profile).
Some complications to be aware of:
1. You have to determine whether the option Preferences > Presets > Store Presets With This Catalog is set and then look in the appropriate locat
...Copy link to clipboard
Copied
Unfortunately, when enhanced profiles were added to LR 7.3, they weren't added to the SDK.
I think your only option is to examine the various settings folders for .xmp files and use LrXml to read the contents of each .xmp file to determine its name (as displayed in LR) and its type (develop preset or enhanced profile).
Some complications to be aware of:
1. You have to determine whether the option Preferences > Presets > Store Presets With This Catalog is set and then look in the appropriate location for the settings folder. LrPathUtils.getStandardFilePath ("appData") isn't cognizant of the Preferences settings.
You could search the preferences file to determine the (near) current setting of the option, or you could enumerate all develop presets and examine their current file location. Each is imperfect -- I've included the function I use for the latter.
2. The Imported Settings folder is always read and never stored in the catalog folder. (That's a bizarre deliberate design choice by Adobe that was never justified.)
--[[----------------------------------------------------------------------------
void
determineSettingsLocation ()
Determines the location of the Settings folder, which could be in the user's
Appdata/Library or in the catalog folder. Shows a progress bar, since LR has
an N^2 bug for enumerating presets and this could take a long time for those
users with hundreds or thousands of presets.
Sets the global "settingsFolder" to the path of the settings folder, or nil if
we can't determine it (because there aren't any created presets).
------------------------------------------------------------------------------]]
function determineSettingsLocation ()
callWithContext ("", showErrors (function (context)
local scope = LrDialogs.showModalProgressDialog {
title = "Scanning presets", functionContext = context}
scope:setIndeterminate ()
settingsFolder = nil
for _, folder in ipairs (LrApplication.developPresetFolders ()) do
for _, preset in ipairs (folder:getDevelopPresets ()) do
local path = presetPath (preset)
if CatalogSettingsFolder ==
path:sub (1, #CatalogSettingsFolder)
then
settingsFolder = CatalogSettingsFolder; break
elseif SettingsFolder == path:sub (1, #SettingsFolder) then
settingsFolder = SettingsFolder; break
end
scope:setCaption (preset:getName ())
end
end
scope:done ()
end))
LrTasks.sleep (0) -- force progress bar to close
end
Copy link to clipboard
Copied
I already figured out the scanning of the xmp files, however I missed the "Preferences > Presets > Store Presets With This Catalog" consequences.
Thank you!