diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:48:56 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-07-11 21:48:56 +0200 |
commit | a857f247d9a71b88a4f0dbcfa95e3679e8456e70 (patch) | |
tree | 846ddcd8117be1505a970e3638fc65d0ec954a2e /config/essentials/vis/backup.lua | |
parent | 75196520b3d6a0e60db1d03a64aaa0655cc4f202 (diff) | |
parent | 6251d6ba1054cd79387f0f88ce25d2f4bc8b78c4 (diff) |
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'config/essentials/vis/backup.lua')
-rw-r--r-- | config/essentials/vis/backup.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/config/essentials/vis/backup.lua b/config/essentials/vis/backup.lua index 7c44c60..2c8f0b8 100644 --- a/config/essentials/vis/backup.lua +++ b/config/essentials/vis/backup.lua @@ -20,6 +20,10 @@ end -- Before saving the file, copy the current contents of the file to a backup file vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) + if file == nil then + return + end + if file.size > backup.byte_limit then return end @@ -46,7 +50,7 @@ vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) end) -- Set defaults -backup.directory = os.getenv("XDG_DATA_HOME") .. "/Trash/vis-backups" +backup.directory = (os.getenv("XDG_DATA_HOME") or (os.getenv("HOME") .. "/.local/share")) .. "/Trash/vis-backups" backup.get_fname = backup.entire_path_with_double_percentage_signs |