mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[plugin] Add folder check in move-to-archive (#11262)
This commit is contained in:
@@ -758,6 +758,11 @@ function util.pathExists(path)
|
||||
return lfs.attributes(path, "mode") ~= nil
|
||||
end
|
||||
|
||||
--- Checks if the given directory exists.
|
||||
function util.directoryExists(path)
|
||||
return lfs.attributes(path, "mode") == "directory"
|
||||
end
|
||||
|
||||
--- As `mkdir -p`.
|
||||
-- Unlike [lfs.mkdir](https://keplerproject.github.io/luafilesystem/manual.html#mkdir)(),
|
||||
-- does not error if the directory already exists, and creates intermediate directories as needed.
|
||||
|
||||
@@ -50,7 +50,7 @@ function MoveToArchive:addToMainMenu(menu_items)
|
||||
{
|
||||
text = _("Go to archive folder"),
|
||||
callback = function()
|
||||
if self.archive_dir_path then
|
||||
if self.archive_dir_path and util.directoryExists(self.archive_dir_path) then
|
||||
self:openFileBrowser(self.archive_dir_path)
|
||||
else
|
||||
self:showNoArchiveConfirmBox()
|
||||
|
||||
Reference in New Issue
Block a user