Add HOME directory expansion also for open file command

This commit is contained in:
Francesco Abbate committed 2020-12-20 00:31:49 +01:00
1 parent 4401f33c19
commit 9a12d47afd
2 files changed
+15 -16

No files matched your search

+6 -4
View File
@@ -153,16 +153,18 @@ end
function common.home_encode(text)
local n = #HOME
if text:sub(1, n) == HOME and text:sub(n + 1, n + 1):match("[/\\\\]") then
return "~" .. text:sub(n + 1)
if HOME then
local n = #HOME
if text:sub(1, n) == HOME and text:sub(n + 1, n + 1):match("[/\\\\]") then
return "~" .. text:sub(n + 1)
end
end
return text
end
function common.home_expand(text)
return text:gsub("^~", HOME)
return HOME and text:gsub("^~", HOME) or text
end