[plugin] Add folder check in move-to-archive (#11262)

This commit is contained in:
mergen3107
2023-12-27 14:45:16 -05:00
committed by GitHub
parent ac5d662eb4
commit 57cbde5901
2 changed files with 6 additions and 1 deletions

View File

@@ -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.

View File

@@ -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()