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

reviewable/pr11285/r1
mergen3107 4 months ago committed by GitHub
parent ac5d662eb4
commit 57cbde5901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save