summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/autofire/autofire_save.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/autofire/autofire_save.lua')
-rw-r--r--plugins/autofire/autofire_save.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/autofire/autofire_save.lua b/plugins/autofire/autofire_save.lua
index 52586c461ad..f863b003f4d 100644
--- a/plugins/autofire/autofire_save.lua
+++ b/plugins/autofire/autofire_save.lua
@@ -75,9 +75,7 @@ end
function lib:save_settings(buttons)
local path = get_settings_path()
local attr = lfs.attributes(path)
- if not attr then
- lfs.mkdir(path)
- elseif attr.mode ~= 'directory' then
+ if attr and (attr.mode ~= 'directory') then
emu.print_error(string.format('Error saving autofire settings: "%s" is not a directory', path))
return
end
@@ -85,6 +83,8 @@ function lib:save_settings(buttons)
if #buttons == 0 then
os.remove(filename)
return
+ elseif not attr then
+ lfs.mkdir(path)
end
local json = require('json')
local settings = serialize_settings(buttons)