Now how can I find in plugin in which directory is plugin installed?
Maybe there is a API function to get a current profile name of running
instance? In that case I can find a plugin directory too.
Thank you for your help.
--
Oleksandr Shneyder
Dipl. Informatik
X2go Core Developer Team
email: oleksandr...@obviously-nice.de
web: www.obviously-nice.de
--> X2go - everywhere@home
Regards,
Georg
Have a nice day.
Is this a plugin binary, or an extension? Binary plugins typically don't
know or care where they are installed. For extensions using __LOCATION__
from a JS file is the recommended solution:
https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO#Getting_your_extension%27s_folder
--BDS
I've exactly the same question but I'm developing under MS Windows.
I need to know how to read a sort of configuration file for the plugin
because I need to let the plugin read/edit the following information:
- custom cache folder path
- custom cache dimension
- others
Since it seems that a plugin CANNOT access registry values, I've
thought of this config file.
If there are others acceptable solutions, please let me know.
Regards
> I've exactly the same question but I'm developing under MS Windows.
I Windows you can use the DLL API functions [1] in the plugin source
code to return the full path to its DLL:
#include <windows.h>
...
char pluginpath[1024];
HMODULE module;
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(char *)NP_Initialize,
&module);
GetModuleFileNameA(module, pluginpath, 1024);
FreeLibrary(module);
In Linux would be in this way:
/* Compile with -ldl */
#include <dlfcn.h>
/* See man dladdr(3) */
typedef struct {
const char *dli_fname; /* Pathname of shared object that
contains address */
void *dli_fbase; /* Address at which shared object
is loaded */
const char *dli_sname; /* Name of nearest symbol with address
lower than addr */
void *dli_saddr; /* Exact address of symbol named
in dli_sname */
} Dl_info;
...
Dl_info dlinfo;
if (dladdr(NP_Initialize, &dlinfo)) {
snprintf(pluginpath, 1024, "%s", dlinfo.dli_fname);
}
[1] http://msdn.microsoft.com/en-us/library/ms682599(VS.85).aspx