aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/args.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-04-10 13:45:16 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-04-10 13:45:16 -0400
commit4c19557eacc414035f17d8ec2ba5e6b2cf12337c (patch)
treeb406aa7301ba9cf9413a227f65639028f0ad766f /core/args.lua
parent9e0c7cd5202d738bebc92a1e6c332f6a07fff245 (diff)
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.
Diffstat (limited to 'core/args.lua')
-rw-r--r--core/args.lua7
1 files changed, 5 insertions, 2 deletions
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