Skip to content

Commit

Permalink
Support DxO PureRAW 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sto3014 committed Mar 18, 2022
1 parent cb9746d commit c353e85
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
22 changes: 17 additions & 5 deletions src/main/lua/lrpureraw.lrdevplugin/InfoProvider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ local logger = require("Logger")

local InfoProvider = {}

--[[----------------------------------------------------------------------------
-----------------------------------------------------------------------------]]
local function getPureRawVersion(pureRawDir)
local version = string.sub(pureRawDir, -5, -5)
if (version ~= "W") then
return version
else
return 1
end
end
--[[----------------------------------------------------------------------------
-----------------------------------------------------------------------------]]
function InfoProvider.sectionsForTopOfDialog(f, _)
Expand Down Expand Up @@ -235,13 +245,15 @@ function InfoProvider.sectionsForTopOfDialog(f, _)

if type(pureRawDir) == "table" and #pureRawDir > 0 then
if (pureRawDir[1]:sub(-#".app") == ".app") then
local pureRawExe = prefs.PureRawExe
local newToolPath = pureRawDir[1] .. "/Contents/MacOS/" .. pureRawExe
prefs.PureRawDir = pureRawDir[1]
prefs.PureRawPath = newToolPath
if LrFileUtils.exists(newToolPath) ~= "file" then
local version = getPureRawVersion(prefs.PureRawDir)
logger.trace("version=" .. tostring(version))
prefs.PureRawExe = "PureRawv" .. version
prefs.PureRawPath = prefs.PureRawDir .. "/Contents/MacOS/" .. prefs.PureRawExe
logger.trace(prefs.PureRawPath)
if LrFileUtils.exists(prefs.PureRawPath) ~= "file" then
prefs.hasErrors = true
LrDialogs.message(LOC("$$$/LRPureRaw/Settings/NoFile=File not found"), LOC("$$$/LRPureRaw/Settings/NoExe=The folder chosen does not contain ^1.", pureRawExe), critical)
LrDialogs.message(LOC("$$$/LRPureRaw/Settings/NoFile=File not found"), LOC("$$$/LRPureRaw/Settings/NoExe=The folder chosen does not contain ^1.", "Contents/MacOS/" .. prefs.PureRawExe), critical)
end
else
LrDialogs.message(LOC("$$$/LRPureRaw/Settings/BadPath=Path is incorrect"), LOC("$$$/LRPureRaw/Settings/NotAnApp=Selected file is not an application."), critical)
Expand Down
37 changes: 23 additions & 14 deletions src/main/lua/lrpureraw.lrdevplugin/InitProvider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,29 @@ function init()
--
-- macOS
--
if prefs.PureRawPath == nil or prefs.PureRawPath:len() == 0 then
pureRawDir = '/Applications/DxO PureRAW.app'
prefs.PureRawDir = pureRawDir
end
if (prefs.PureRawExe == nil or prefs.PureRawExe:len() == 0) then
prefs.PureRawExe = "PureRawv1"
end
prefs.PureRawPath = prefs.PureRawDir .. "/Contents/MacOS/" .. prefs.PureRawExe
if (LrFileUtils.exists(prefs.PureRawPath) ~= "file") then
for i = 1, 5, 1 do
local tempPath = prefs.PureRawDir .. "/Contents/MacOS/" .. "PureRawv" .. tostring(i)
if (LrFileUtils.exists(tempPath) == "file") then
prefs.PureRawExe = "PureRawv" .. tostring(i)
prefs.PureRawPath = tempPath
if (prefs.PureRawPath == nil or prefs.PureRawPath:len() == 0) then
-- Default values since 18.03.2022
prefs.PureRawDir = '/Applications/DxO PureRAW 2.app'
prefs.PureRawExe = "PureRawv2"
prefs.PureRawPath = prefs.PureRawDir .. "/Contents/MacOS/" .. prefs.PureRawExe
if (LrFileUtils.exists(prefs.PureRawPath) ~= "file") then
for i = 5, 1, -1 do
local tempPath
local tempExe
local tempDir
tempExe = "PureRawv" .. tostring(i)
if ( i == 1 ) then
tempDir = "/Applications/DxO PureRAW.app"
else
tempDir = "/Applications/DxO PureRAW " .. tostring(i) .. ".app"
end
tempPath = tempDir .. "/Contents/MacOS/" .. tempExe
if (LrFileUtils.exists(tempPath) == "file") then
prefs.PureRawExe = tempExe
prefs.PureRawPath = tempPath
prefs.PureRawDir = tempDir
break
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ end


function PureRawExportFilterProvider.sectionForFilterInDialog(f, propertyTable)
logger.trace("sectionForFilterInDialog() start")
local prefs = LrPrefs.prefsForPlugin()
local bind = LrView.bind
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ end
local function startDxoPureRAW()
-------------------------------------------------------------------------------]]
local function startDxoPureRAW(images)
logger.trace("startDxoPureRAW() start")

local prefs = LrPrefs.prefsForPlugin()

local cmd
Expand All @@ -235,6 +237,7 @@ end
local function resetMetadata()
-------------------------------------------------------------------------------]]
local function resetMetadata(exportContext)
logger.trace("resetMetadata() start")
local prefs = LrPrefs.prefsForPlugin()
local images = {}
local catalog = LrApplication.activeCatalog()
Expand Down Expand Up @@ -294,6 +297,7 @@ end
local function validateExclude()
-------------------------------------------------------------------------------]]
local function validateExclude()
logger.trace("validateExclude() start")
local prefs = LrPrefs.prefsForPlugin()
if (not prefs.process.FilterIsActive) then
return true
Expand Down Expand Up @@ -329,6 +333,8 @@ end
local function validateDestinationType()
-------------------------------------------------------------------------------]]
local function validateDestinationType(exportContext)
logger.trace("validateDestinationType() start")

local exportSettings = assert(exportContext.propertyTable)

if (exportSettings.LR_export_destinationType ~= "specificFolder") then
Expand Down

0 comments on commit c353e85

Please sign in to comment.