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

Post your questions here and we'll all try to help.
Post Reply
alphasuede
Posts: 8
Joined: Sun Jun 28, 2009 02:07

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

Post 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?

edwin
Team Resolume
Posts: 1207
Joined: Thu Oct 07, 2004 10:40

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

Post 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';


alphasuede
Posts: 8
Joined: Sun Jun 28, 2009 02:07

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

Post 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

Post Reply