Question

Is there some predicate or variable that one can use in the extension code to determine whether it was installed normally or in developer mode?

(I'd like to put some debug output visible only in developer mode.)

Was it helpful?

Solution

No, there is no way to get this info directly.

But what you can do is the following:
Create a file with the name debug.txt (or what you want) in your extensions folder.
Make sure you always delete this file when creating the zipped .oex-file!

Now you can add the following code to your background script:

var debugFile = opera.extension.getFile("/debug.txt");
if (debugFile) {
    //This is debug mode!!
}

You will get a valid [File]-Object if the file exists and null otherwise.

(Infos: http://dev.opera.com/articles/view/extensions-api-resourceloader/)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top