aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtelem.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/telem.lua b/telem.lua
index 9675136..710bd20 100755
--- a/telem.lua
+++ b/telem.lua
@@ -298,7 +298,10 @@ function create_post()
os.execute(_EDITOR .. " " .. filename)
-- Check that file exists and is not empty
if not path.exists(filename) then return nil end
- if lfs.attributes(filename).size == 0 then return nil end
+ if lfs.attributes(filename).size == 0 then
+ file.delete(filename)
+ return nil
+ end
-- Get confirmation from user
print("PREVIEW:")
print(string.rep("-",79))
@@ -314,6 +317,7 @@ function create_post()
if c == "e" then
goto edit
elseif c == "n" then
+ file.delete(filename)
return nil
else
return filename