Page 1 of 1

c++: Determining a Plugin's filename and resource directory?

Posted: Mon Aug 24, 2009 22:16
by alphasuede
Is there a way to determine the path of a plugin?

For example, if i have a plugin located in some unknown path:
unknownpath/resolume/plugins/vfx/unknownpath/myplugin.bundle
or
unknownpath/resolume/plugins/vfx/unknownpath/myplugin.dll

is there a way to find that out from within the plugin. Unfortunately calls to standard C++ directory listing functions give the path that the resolume was started from. Not the path of the plugin.

I am looking for some sort of magic function
std:string path = WhatIsMyPluginCurrentFilenameAndPath();

The reason I need this, is that I would like to write a plugin for resolume that can load resources from the directory it was installed in. On the mac, that could be inside the recourse bundle of the plugin. On the pc, that would be the directory the DLL is installed in. Has anyone been able to achive this?

Re: c++: Determining a Plugin's filename and resource directory?

Posted: Tue Aug 25, 2009 11:08
by edwin
On Windows I think you need to use the GetModuleFileName function.

Code: Select all

//code getting the path...

char *pStr, szPath[_MAX_PATH]; 
GetModuleFileName(hInstance, szPath, _MAX_PATH); 
pStr = strrchr(szPath, '\\'); 
if (pStr != NULL) 
    *(++pStr)='\0';


Re: c++: Determining a Plugin's filename and resource directory?

Posted: Tue Aug 25, 2009 22:37
by alphasuede
Thanks...

I'll check that out when I compile it for Windows. In the mean time I made my own function for the mac. There is probably a simpler system call like what you listed...

Clement