Files
diya-shell/hooks/compile_schemas.lua
Dany LE 377eaf7d84 feat: Add hook mechanism + use gsettings:
- Allow to install hooks that execute lua scripts on changes of watched files
- Use gsetting to store shell parameters such as: theme, idle-timeout, etc.
2025-10-13 18:08:50 +02:00

21 lines
773 B
Lua

local schemas_dir = diya.system.user_data_dir() .. "/glib-2.0/schemas"
local target_dir = diya.system.user_config_dir() .. "/diya/schemas/"
local session_schemas = schemas_dir.."/dev.iohub.diya.session.gschema.xml"
if not diya.system.file_exists(session_schemas) then
-- copy session schemas if not exists
diya.system.save_resource("/dev/iohub/diya/shell/schemas/session.gschema.xml", session_schemas)
return
end
-- create the compiled schemas dir if not exists
diya.system.mkdir(target_dir)
local cmd = "/usr/bin/glib-compile-schemas --targetdir="..target_dir.." "..schemas_dir -- .." &"
diya.system.log_info("Executing: "..cmd)
local handle = io.popen(cmd)
local result = handle:read("*a") -- Reads all output
handle:close()
diya.system.log_info(result)