[DocSettingTweak] Use absolute path for document settings (#14418)

External plugins that load files may load them using relative paths instead of absolute paths. This enables these plugins to make use of the per-directory document settings feature.
This commit is contained in:
DemonicSavage
2025-10-16 05:08:28 -03:00
committed by GitHub
parent 158463fd9f
commit 9a7b3624f7

View File

@@ -93,7 +93,8 @@ function DocSettingTweak:onDocSettingsLoad(doc_settings, document)
-- check that the document has not been opened yet & and that we have defaults to customize
if document.is_new and directory_defaults.data ~= nil then
local base = G_reader_settings:readSetting("home_dir") or filemanagerutil.getDefaultDir()
local directory = FFIUtil.dirname(document.file)
local absolute_path = FFIUtil.realpath(document.file)
local directory = FFIUtil.dirname(absolute_path)
-- check if folder matches our defaults to override
while directory:sub(1, #base) == base do
if directory_defaults:has(directory) then