From 3c284b0ba3312e348eb64ead77a5a916d634c3cb Mon Sep 17 00:00:00 2001 From: James Coon Date: Sat, 27 Jun 2015 23:50:46 -0600 Subject: [PATCH] Allow save path to be specified from the command line to boot.lua --- src/boot.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/boot.lua b/src/boot.lua index d915d53..94fff3d 100755 --- a/src/boot.lua +++ b/src/boot.lua @@ -6,6 +6,13 @@ local lfs = require("lfs") local sdlinit = false +local args = table.pack(...) +local emulationInstancePath = (os.getenv("HOME") or os.getenv("APPDATA")) .. "/.ocemu" + +if #args > 0 then + emulationInstancePath = args[1] +end + local function boot() local ret, err = not b(SDL.init(SDL.INIT_AUDIO + SDL.INIT_EVENTS + SDL.INIT_VIDEO)) @@ -108,7 +115,7 @@ local function boot() return lfs.attributes(path,"size") end, getSaveDirectory = function() - return (os.getenv("HOME") or os.getenv("APPDATA")) .. "/.ocemu" + return emulationInstancePath end, remove = function(path) return recursiveDelete(path) @@ -149,6 +156,7 @@ local function boot() SDL.delay(1) end end + print(xpcall(boot,debug.traceback)) if sdlinit then SDL.quit()