mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Skip the migration and use ffi/util.joinPath() to join paths
This commit is contained in:
@@ -12,7 +12,7 @@ local util = require("util")
|
||||
local _ = require("gettext")
|
||||
|
||||
-- Date at which the last migration snippet was added
|
||||
local CURRENT_MIGRATION_DATE = 20250629
|
||||
local CURRENT_MIGRATION_DATE = 20250601
|
||||
|
||||
-- Retrieve the date of the previous migration, if any
|
||||
local last_migration_date = G_reader_settings:readSetting("last_migration_date", 0)
|
||||
@@ -888,28 +888,6 @@ if last_migration_date < 20250601 then
|
||||
SettingsMigration:migrateSettings(G_reader_settings)
|
||||
end
|
||||
|
||||
-- 20250629, Fix trailing slashes in wallabag directories #13987
|
||||
-- https://github.com/koreader/koreader/issues/13987
|
||||
if last_migration_date < 20250629 then
|
||||
logger.info("Performing one-time migration for 20250629")
|
||||
|
||||
local wb_lua = DataStorage:getSettingsDir() .. "/wallabag.lua"
|
||||
if lfs.attributes(wb_lua, "mode") == "file" then
|
||||
local wb_settings = LuaSettings:open(wb_lua)
|
||||
wb_settings:readSetting("wallabag")
|
||||
|
||||
if wb_settings.data.wallabag.directory:sub(-1) == "/" then
|
||||
wb_settings.data.wallabag.directory = wb_settings.data.wallabag.directory:gsub("/$", "")
|
||||
end
|
||||
|
||||
if wb_settings.data.wallabag.archive_directory:sub(-1) == "/" then
|
||||
wb_settings.data.wallabag.archive_directory = wb_settings.data.wallabag.archive_directory:gsub("/$", "")
|
||||
end
|
||||
|
||||
wb_settings:saveSetting("wallabag", wb_settings.data.wallabag)
|
||||
wb_settings:flush()
|
||||
end
|
||||
end
|
||||
|
||||
-- We're done, store the current migration date
|
||||
G_reader_settings:saveSetting("last_migration_date", CURRENT_MIGRATION_DATE)
|
||||
|
||||
@@ -114,7 +114,7 @@ function Wallabag:init()
|
||||
self.archive_directory = self.wb_settings.data.wallabag.archive_directory
|
||||
if not self.archive_directory or self.archive_directory == "" then
|
||||
if self.directory and self.directory ~= "" then
|
||||
self.archive_directory = self.directory.."/archive"
|
||||
self.archive_directory = FFIUtil.joinPath(self.directory, "archive")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -757,7 +757,7 @@ function Wallabag:downloadArticle(article)
|
||||
end
|
||||
end
|
||||
|
||||
local local_path = self.directory.."/"..article_id_prefix..article.id..article_id_postfix..title..file_ext
|
||||
local local_path = FFIUtil.joinPath(self.directory, article_id_prefix..article.id..article_id_postfix..title..file_ext)
|
||||
logger.dbg("Wallabag:downloadArticle: downloading", article.id, "to", local_path)
|
||||
|
||||
local attr = lfs.attributes(local_path)
|
||||
@@ -1079,7 +1079,7 @@ function Wallabag:processRemoteDeletes(remote_ids)
|
||||
local count = 0
|
||||
|
||||
for entry in lfs.dir(self.directory) do
|
||||
local entry_path = self.directory.."/"..entry
|
||||
local entry_path = FFIUtil.joinPath(self.directory, entry)
|
||||
|
||||
if entry ~= "." and entry ~= ".." and lfs.attributes(entry_path, "mode") == "file" then
|
||||
local local_id = self:getArticleID(entry_path)
|
||||
@@ -1128,7 +1128,7 @@ function Wallabag:uploadStatuses(quiet)
|
||||
local skip = false
|
||||
|
||||
if entry ~= "." and entry ~= ".." then
|
||||
local entry_path = self.directory.."/"..entry
|
||||
local entry_path = FFIUtil.joinPath(self.directory, entry)
|
||||
|
||||
if DocSettings:hasSidecarFile(entry_path) then
|
||||
logger.dbg("Wallabag:uploadStatuses:", entry_path, "has sidecar file")
|
||||
@@ -1324,7 +1324,7 @@ function Wallabag:archiveLocalArticle(path)
|
||||
|
||||
if lfs.attributes(path, "mode") == "file" then
|
||||
local _, file = util.splitFilePathName(path)
|
||||
local new_path = self.archive_directory.."/"..file
|
||||
local new_path = FFIUtil.joinPath(self.archive_directory, file)
|
||||
if FileManager:moveFile(path, new_path) then
|
||||
result = 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user