aboutsummaryrefslogtreecommitdiff
path: root/plugins/lastproject.lua
diff options
context:
space:
mode:
authorrxi <rxi@users.noreply.github.com>2020-11-29 09:52:08 +0000
committerGitHub <noreply@github.com>2020-11-29 09:52:08 +0000
commiteae34e5b7863bf5fa0db3bf133fb9b2b667266fd (patch)
tree600aa8c62c1b73e8dc5a143485dd8ea08a3c3db8 /plugins/lastproject.lua
parenta5257204d5be911f94ef8b50d8032e36832ccf8d (diff)
parentb703c0ae4da6c5dd9d5c264050ba1388b601d8c2 (diff)
downloadlite-xl-plugins-eae34e5b7863bf5fa0db3bf133fb9b2b667266fd.tar.gz
lite-xl-plugins-eae34e5b7863bf5fa0db3bf133fb9b2b667266fd.zip
Merge pull request #101 from SwissalpS/lastProjectFixNilCheck
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
+