Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How To Tell If -console Was Specified?

6 views
Skip to first unread message

us...@domain.invalid

unread,
Nov 13, 2006, 8:14:45 PM11/13/06
to
I was wondering if anyone can tell me how my addin can tell if the
-console flag was specified on the FF or T-Bird command line?

It seemed that I SHOULD be able to get an instance of nsICommandLine
(from @mozilla.org/toolkit/command-line;1) and be able to call its
findFlag("console", false) method. But this did not work (it returned -1).

I also tried a loop from 0 < nsICommandLine.length calling
nsiCommandLine.getArgument() and looking at the results. But the length
property returned 0 and so that was a non-starter as well.

I note that nsICommandLine also includes a removeArguments() method and
I wonder if that could have been called somewhere along the line
removing the -console that I KNOW I passed in (I can see the console
window on Windows).

Thanks for any pointers here.

Mook

unread,
Nov 14, 2006, 2:11:55 PM11/14/06
to

Are you making a new instance of nsICommandLine (or rather,
@mozilla.org/toolkit/command-line;1)? It's not a service, and the only
valid command line (well, the command line that actually launched the
app) probably got dropped pretty early on. Making a new command line
would of course not give you the parameters you want...

As far as I'm aware the only way to get a useful nsICommandLine is to
implement a nsICommandLineHandler (which gets passed in a nsICommandLine
from... umm, whoever has the actual thing.)

HTH,

--
Mook
mook dot moz plus stuff at gmail dot commandline

us...@domain.invalid

unread,
Nov 15, 2006, 1:06:44 PM11/15/06
to
Thanks for the response. I believe I called createInstance() to get what
I was working with. I should have thought the original command line
would have been held around - maybe in a singleton instance. But it
seems that it is not. I guess I could implement the command line
handler. It does seem a pain just to interrogate what was specified by
the user. But if code can "remove" arguments then this might not work
anyway.
0 new messages