Skip to content

Commit

Permalink
Go Big or Go Home! (#5163)
Browse files Browse the repository at this point in the history
* Tweak goHome to assume sane-ish defaults if no custom home dir is set (re #5154)
* If we're already in Home, make goHome send us to the first page.
  • Loading branch information
NiLuJe committed Aug 2, 2019
1 parent e296109 commit affc0f4
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions frontend/apps/filemanager/filemanager.lua
Expand Up @@ -560,9 +560,35 @@ end
function FileManager:goHome()
local home_dir = G_reader_settings:readSetting("home_dir")
if home_dir then
self.file_chooser:changeToPath(home_dir)
-- Jump to the first page if we're already home
if self.file_chooser.path and home_dir == self.file_chooser.path then
self.file_chooser:onGotoPage(1)
else
self.file_chooser:changeToPath(home_dir)
end
else
self:setHome()
-- Try some sane defaults, depending on platform
if Device:isKindle() then
home_dir = "/mnt/us"
elseif Device:isKobo() then
home_dir = "/mnt/onboard"
elseif Device:isPocketBook() then
home_dir = "/mnt/ext1"
elseif Device:isCervantes() then
home_dir = "/mnt/public"
elseif Device:isAndroid() then
home_dir = "/sdcard"
end

if home_dir then
if self.file_chooser.path and home_dir == self.file_chooser.path then
self.file_chooser:onGotoPage(1)
else
self.file_chooser:changeToPath(home_dir)
end
else
self:setHome()
end
end
return true
end
Expand Down

0 comments on commit affc0f4

Please sign in to comment.