mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #1986 from chrox/fix_1985
fix #1985 by always return to the parent dir of current doc in the FileManager
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user