From 4c19557eacc414035f17d8ec2ba5e6b2cf12337c Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 10 Apr 2012 13:45:16 -0400 Subject: Support for single-instance on Linux and BSD with GLib 2.28. Also added documentation on running with LuaJIT and require GTK+ 2.18 now. --- core/args.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/args.lua b/core/args.lua index 7d2c6e4b..46ea7769 100644 --- a/core/args.lua +++ b/core/args.lua @@ -37,9 +37,10 @@ end -- Add command line switches with `args.register()`. Any unrecognized arguments -- are treated as filepaths and opened. -- Generates an `'arg_none'` event when no args are present. +-- @param arg Argument table. -- @see register -- @name process -function M.process() +function M.process(arg) local no_args = true local i = 1 while i <= #arg do @@ -53,7 +54,8 @@ function M.process() else if not arg[i]:find(not WIN32 and '^/' or '^%u:[/\\]') then -- Convert relative path to absolute path. - arg[i] = lfs.currentdir()..(not WIN32 and '/' or '\\')..arg[i] + local cwd = arg[-1] or lfs.currentdir() + arg[i] = cwd..(not WIN32 and '/' or '\\')..arg[i] end io.open_file(arg[i]) no_args = false @@ -99,5 +101,6 @@ end _G._USERHOME = userhome M.register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME') +M.register('-f', '--force', 0, function() end, 'Forces unique instance') return M -- cgit v1.2.3