Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tools/executable_manager - reworked to use the executable paths
                           enhancements in the file library so
                           that executable paths can be assigned
                           to new executables that they system was
                           unable to detect.
  • Loading branch information
wpferguson committed Jun 22, 2024
commit 056cc245e906b7067af807eae21b45fed21ef713
51 changes: 37 additions & 14 deletions tools/executable_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,30 +146,53 @@ end
-- M A I N P R O G R A M
-- - - - - - - - - - - - - - - - - - - - - - - - - - - -

local DARKTABLERC = dt.configuration.config_dir .. PS .. "darktablerc"
local exec_table = {}

local DARKTABLERC <const> = dt.configuration.config_dir .. PS .. "darktablerc"

-- grep the executable_paths statements out of the darktablerc file
-- see if we have known executables

local matches = grep(DARKTABLERC, "executable_paths")
local known_executables = dt.preferences.read("executable_manager", "known_executables", "string")

-- check if we have something to manage and exit if not
dt.print_log("known_executables is " .. tostring(known_executables))

if #matches == 0 then
dt.print(_("no executable paths found, exiting..."))
return
end
if not known_executables or known_executables:len() == 0 then

-- build a table of the path preferences
known_executables = ""

local exec_table = {}
-- grep the executable_paths statements out of the darktablerc file

local matches = grep(DARKTABLERC, "executable_paths")

for _,pref in ipairs(matches) do
local parts = du.split(pref, "=")
local tmp = du.split(parts[1], "/") -- preferences are stored with forward slashes
table.insert(exec_table, tmp[#tmp])
-- check if we have something to manage and exit if not

if #matches == 0 then
dt.print(_("no executable paths found, exiting..."))
return
end

for _,pref in ipairs(matches) do
dt.print_log("processing pref " .. pref)
local parts = du.split(pref, "=")
dt.print_log("parts 1 is " .. parts[1])
local tmp = du.split(parts[1], "/") -- preferences are stored with forward slashes
known_executables = known_executables .. tmp[#tmp] .. ","
end

-- remove the trailing comma

known_executables = known_executables:sub(1, -2)

dt.preferences.write("executable_manager", "known_executables", "string", known_executables)
end

dt.print_log("known_executables is " .. known_executables)


-- build a table of the path preferences

local exec_table = du.split(known_executables, ",")

local executable_path_widgets = {}
local executable_path_values = {}
local placeholder_text = dt.configuration.running_os == windows and _("select an executable") or _("search path for executable")
Expand Down