diff options
author | 2017-02-16 21:50:34 -0600 | |
---|---|---|
committer | 2017-02-16 21:50:57 -0600 | |
commit | eed65a01ac23ee7ad2f6641b6133b89ec2bf7a76 (patch) | |
tree | 6df6a5b0c8339d5bc6f77f639030140e145bfd2c /plugins/data/load_dat.lua | |
parent | a63e6c0ac8c3f7f7f8b41a98d3abaeab245c5c8c (diff) |
plugins/data: create first dir in historypath if it doesn't exist (nw)
Diffstat (limited to 'plugins/data/load_dat.lua')
-rw-r--r-- | plugins/data/load_dat.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/data/load_dat.lua b/plugins/data/load_dat.lua index c1cb437d3af..0cbc3d3c83a 100644 --- a/plugins/data/load_dat.lua +++ b/plugins/data/load_dat.lua @@ -1,6 +1,14 @@ local sql = require("lsqlite3") local datfile = {} -local db = sql.open(lfs.env_replace(mame_manager:ui():options().entries.historypath:value():match("([^;]+)")) .. "/history.db") +local db +do + local dbpath = lfs.env_replace(mame_manager:ui():options().entries.historypath:value():match("([^;]+)")) + db = sql.open(dbpath .. "/history.db") + if not db then + lfs.mkdir(dbpath) + db = sql.open(dbpath .. "/history.db") + end +end if db then local found = false db:exec("select * from sqllite_master where name = version", function() found = true return 0 end) |