aboutsummaryrefslogtreecommitdiff
path: root/plugins/lastproject.lua
diff options
context:
space:
mode:
authorSwissalpS <Luke@SwissalpS.ws>2020-11-18 18:22:18 +0100
committerSwissalpS <Luke@SwissalpS.ws>2020-11-18 18:22:18 +0100
commitb703c0ae4da6c5dd9d5c264050ba1388b601d8c2 (patch)
tree559022db3c026beff7135fcc96af4f85e315893d /plugins/lastproject.lua
parentde4227d55a5c821e3450554c952dfb3b1b192266 (diff)
downloadlite-xl-plugins-b703c0ae4da6c5dd9d5c264050ba1388b601d8c2.tar.gz
lite-xl-plugins-b703c0ae4da6c5dd9d5c264050ba1388b601d8c2.zip
check if file handle actually exists
Diffstat (limited to 'plugins/lastproject.lua')
-rw-r--r--plugins/lastproject.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/lastproject.lua b/plugins/lastproject.lua
index 09ca507..5fb23bd 100644
--- a/plugins/lastproject.lua
+++ b/plugins/lastproject.lua
@@ -14,8 +14,10 @@ end
-- save current project path
local fp = io.open(last_project_filename, "w")
-fp:write(system.absolute_path ".")
-fp:close()
+if nil ~= fp then
+ fp:write(system.absolute_path ".")
+ fp:close()
+end
-- restart using last project path if we had no commandline arguments and could
@@ -24,3 +26,4 @@ if #ARGS == 1 and project_path then
system.exec(string.format("%s %q", EXEFILE, project_path))
core.quit(true)
end
+