aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/file_io.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-12-15 14:44:21 -0500
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-12-15 14:44:21 -0500
commitb3a3739eab13a076625ec5aaee7a8130f0c7a4c0 (patch)
tree7de4e814de3de5dd125d16324ff3082d4f3d4d94 /core/file_io.lua
parent0ad6994a85c6dcd0db14af0224dab2675f3fc8c3 (diff)
Do not show deleted files in recent file list.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 24c04926..3ba57fff 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -311,9 +311,15 @@ end)
-- @see recent_files
-- @name open_recent_file
function io.open_recent_file()
- local utf8_list = {}
- for i = 1, #io.recent_files do
- utf8_list[#utf8_list + 1] = io.recent_files[i]:iconv('UTF-8', _CHARSET)
+ local utf8_list, i = {}, 1
+ while i <= #io.recent_files do
+ local filename = io.recent_files[i]
+ if lfs.attributes(filename) then
+ utf8_list[#utf8_list + 1] = io.recent_files[i]:iconv('UTF-8', _CHARSET)
+ i = i + 1
+ else
+ table.remove(io.recent_files, i)
+ end
end
local button, i = ui.dialogs.filteredlist{
title = _L['Open File'], columns = _L['Filename'], items = utf8_list