diff options
-rw-r--r-- | plugins/data/data_hiscore.lua | 2 | ||||
-rw-r--r-- | plugins/data/load_dat.lua | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/plugins/data/data_hiscore.lua b/plugins/data/data_hiscore.lua index c2dcf0ca370..700a9958ca8 100644 --- a/plugins/data/data_hiscore.lua +++ b/plugins/data/data_hiscore.lua @@ -545,7 +545,7 @@ function dat.check(set, softlist) return script end - if #env == 0 then + if not env.open then function env.open(file, size) if file == ".hi" then local path = "hi" 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) |