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 | |
parent | a63e6c0ac8c3f7f7f8b41a98d3abaeab245c5c8c (diff) |
plugins/data: create first dir in historypath if it doesn't exist (nw)
Diffstat (limited to 'plugins/data')
-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) |