diff options
Diffstat (limited to 'plugins/console/init.lua')
-rw-r--r-- | plugins/console/init.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/console/init.lua b/plugins/console/init.lua index 95218d67389..c9811ba2467 100644 --- a/plugins/console/init.lua +++ b/plugins/console/init.lua @@ -13,6 +13,8 @@ local history_file = "console_history" local history_fullpath = nil +local util = require("util") + function console.startplugin() local conth = emu.thread() local ln_started = false @@ -239,8 +241,8 @@ function console.startplugin() end if (not started) then -- options are not available in startplugin, so we load the history here - local homepath = emu.subst_env(manager.ui.options.entries.homepath:value():match("([^;]+)")) - history_fullpath = homepath .. '/console_history' + local homepath = emu.subst_env(manager.options.entries.homepath:value():match("([^;]+)")) + history_fullpath = homepath .. '/' .. history_file ln.loadhistory(history_fullpath) started = true end @@ -298,7 +300,8 @@ end setmetatable(console, { __gc = function () if history_fullpath then - ln = require("linenoise") + util.create_parent_dirs(history_fullpath) + local ln = require("linenoise") ln.savehistory(history_fullpath) end end}) |