diff options
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) |