FileManager: added button to purge sidecar directory (#2391)

Also move its sidecar directory when moving a file.
pull/2409/head
poire-z 8 years ago committed by Qingping Hou
parent 0aa19d72a0
commit 949e5ba54d

@ -157,6 +157,24 @@ function FileManager:init()
UIManager:close(self.file_dialog)
end,
},
{
text = _("Purge .sdr"),
enabled = DocSettings:hasSidecarDir(util.realpath(file)),
callback = function()
local full_path = util.realpath(file)
util.purgeDir(DocSettings:getSidecarDir(full_path))
self:refreshPath()
-- also remove from history if present
local readhistory = require("readhistory")
for _, hist_item in ipairs(readhistory.hist) do
if hist_item.file == full_path then
readhistory:removeItem(hist_item)
break
end
end
UIManager:close(self.file_dialog)
end,
},
},
{
{
@ -359,6 +377,10 @@ function FileManager:pasteHere(file)
local dest = lfs.attributes(file, "mode") == "directory" and
file or file:match("(.*/)")
if self.cutfile then
-- if we move a file, also move its sidecar directory
if DocSettings:hasSidecarDir(orig) then
self:moveFile(DocSettings:getSidecarDir(orig), dest) -- dest is always a directory
end
self:moveFile(orig, dest)
else
util.execute(self.cp_bin, "-r", orig, dest)

Loading…
Cancel
Save