Skip to content

Commit

Permalink
FileManager: safe initial path (#11774)
Browse files Browse the repository at this point in the history
We do not like trailing slash in the path (except root).
Closes #11772.
  • Loading branch information
hius07 committed May 16, 2024
1 parent 05168b2 commit db63db1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/apps/filemanager/filemanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ function FileManager:reinit(path, focused_file)
UIManager:flushSettings()
self.dimen = Screen:getSize()
-- backup the root path and path items
self.root_path = path or self.file_chooser.path
self.root_path = BaseUtil.realpath(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
Expand Down Expand Up @@ -1208,7 +1208,7 @@ function FileManager:showFiles(path, focused_file)
FileManager.instance:onClose()
end

path = path or G_reader_settings:readSetting("lastdir") or filemanagerutil.getDefaultDir()
path = BaseUtil.realpath(path or G_reader_settings:readSetting("lastdir") or filemanagerutil.getDefaultDir())
G_reader_settings:saveSetting("lastdir", path)
self:setRotationMode()
local file_manager = FileManager:new{
Expand Down
1 change: 0 additions & 1 deletion frontend/apps/reader/readerui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ function ReaderUI:showFileManager(file)
local last_dir, last_file
if file then
last_dir = util.splitFilePathName(file)
last_dir = last_dir:match("(.*)/")
last_file = file
else
last_dir, last_file = self:getLastDirFile(true)
Expand Down

0 comments on commit db63db1

Please sign in to comment.