fix #1985 by always return to the parent dir of current doc in the FileManager

pull/1986/head
chrox 8 years ago
parent a42273e201
commit 92184f0199

@ -229,10 +229,10 @@ function FileManager:init()
self:handleEvent(Event:new("SetDimensions", self.dimen))
end
function FileManager:resetDimen(dimen)
self.dimen = dimen
function FileManager:reinit(path)
self.dimen = Screen:getSize()
-- backup the root path and path items
self.root_path = self.file_chooser.path
self.root_path = path or self.file_chooser.path
local path_items_backup = {}
for k, v in pairs(self.file_chooser.path_items) do
path_items_backup[k] = v

@ -38,14 +38,14 @@ function ReaderMenu:init()
self:onTapCloseMenu()
self.ui:onClose()
local FileManager = require("apps/filemanager/filemanager")
local lastdir = nil
local last_file = G_reader_settings:readSetting("lastfile")
if last_file then
lastdir = last_file:match("(.*)/")
end
if FileManager.instance then
FileManager.instance:resetDimen(Screen:getSize())
FileManager.instance:reinit(lastdir)
else
local lastdir = nil
local last_file = G_reader_settings:readSetting("lastfile")
if last_file then
lastdir = last_file:match("(.*)/")
end
FileManager:showFiles(lastdir)
end
end,

Loading…
Cancel
Save