From 3b97e2988ae842678735e36dace59df422cb0f91 Mon Sep 17 00:00:00 2001 From: Nico Hirsch <30938717+noxhirsch@users.noreply.github.com> Date: Sun, 19 May 2024 13:19:38 +0200 Subject: [PATCH] Shorten home folder path for info messages (#11853) The info messages for opening files always show the full path. By using `filemanagerutil.abbreviate`, the info messages now show the shortened home folder path (only if the setting "shorten home folder" is enabled). --- frontend/apps/reader/readerui.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/apps/reader/readerui.lua b/frontend/apps/reader/readerui.lua index a7deea90f..c336145e3 100644 --- a/frontend/apps/reader/readerui.lua +++ b/frontend/apps/reader/readerui.lua @@ -61,6 +61,7 @@ local Screenshoter = require("ui/widget/screenshoter") local SettingsMigration = require("ui/data/settings_migration") local UIManager = require("ui/uimanager") local ffiUtil = require("ffi/util") +local filemanagerutil = require("apps/filemanager/filemanagerutil") local lfs = require("libs/libkoreader-lfs") local logger = require("logger") local time = require("ui/time") @@ -593,14 +594,14 @@ function ReaderUI:showReader(file, provider, seamless) file = ffiUtil.realpath(file) if lfs.attributes(file, "mode") ~= "file" then UIManager:show(InfoMessage:new{ - text = T(_("File '%1' does not exist."), BD.filepath(file)) + text = T(_("File '%1' does not exist."), BD.filepath(filemanagerutil.abbreviate(file))) }) return end if not DocumentRegistry:hasProvider(file) and provider == nil then UIManager:show(InfoMessage:new{ - text = T(_("File '%1' is not supported."), BD.filepath(file)) + text = T(_("File '%1' is not supported."), BD.filepath(filemanagerutil.abbreviate(file))) }) self:showFileManager(file) return @@ -616,7 +617,7 @@ end function ReaderUI:showReaderCoroutine(file, provider, seamless) UIManager:show(InfoMessage:new{ - text = T(_("Opening file '%1'."), BD.filepath(file)), + text = T(_("Opening file '%1'."), BD.filepath(filemanagerutil.abbreviate(file))), timeout = 0.0, invisible = seamless, })