iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Typedefs | Functions
IPlugPaths.h File Reference

Common paths useful for plug-ins. More...

#include "IPlugUtilities.h"

Go to the source code of this file.

Typedefs

using PluginIDType = void *
 

Functions

void HostPath (WDL_String &path, const char *bundleID=0)
 Get the path to the host binary. More...
 
void PluginPath (WDL_String &path, PluginIDType pExtra)
 Get the path to the plug-in binary. More...
 
void BundleResourcePath (WDL_String &path, PluginIDType pExtra=0)
 Get the path to the plug-in bundle resource path. More...
 
void DesktopPath (WDL_String &path)
 
void UserHomePath (WDL_String &path)
 
void AppSupportPath (WDL_String &path, bool isSystem=false)
 
void VST3PresetsPath (WDL_String &path, const char *mfrName, const char *pluginName, bool isSystem=true)
 
void INIPath (WDL_String &path, const char *pluginName)
 Get the path to the folder where the App's settings.ini file is stored. More...
 
void WebViewCachePath (WDL_String &path)
 Get the path to the folder where the Plug-in's ICoreWebView2 userdata folder should be (Windows WebView only)
 
EResourceLocation LocateResource (const char *fileNameOrResID, const char *type, WDL_String &result, const char *bundleID, void *pHInstance, const char *sharedResourcesSubPath)
 Find the absolute path of a resource based on it's file name (e.g. More...
 
const void * LoadWinResource (const char *resID, const char *type, int &sizeInBytes, void *pHInstance)
 Load a resource from the binary (windows only). More...
 

Detailed Description

Common paths useful for plug-ins.

Definition in file IPlugPaths.h.

Typedef Documentation

◆ PluginIDType

using PluginIDType = void *

Definition at line 27 of file IPlugPaths.h.

Function Documentation

◆ AppSupportPath()

void AppSupportPath ( WDL_String &  path,
bool  isSystem = false 
)
Parameters
pathWDL_String reference where the path will be put on success or empty string on failure
isSystemSet true if you want to obtain the system-wide path, otherwise the path will be in the user's home folder

◆ BundleResourcePath()

void BundleResourcePath ( WDL_String &  path,
PluginIDType  pExtra = 0 
)

Get the path to the plug-in bundle resource path.

On macOS and iOS if this is called in an AUv3 app extension it will return the bundle of the parent app iOS bundles are flat, so the path is just to the .app where as macOS bundles contain a resources subfolder On Windows this is only useful for VST3 plug-ins which have a "bundle" with a resource path since v3.6

Parameters
pathWDL_String reference where the path will be put on success or empty string on failure
pExtraThis should either be a const char* to bundleID (macOS/iOS) or an HMODULE handle (windows)

◆ DesktopPath()

void DesktopPath ( WDL_String &  path)
Parameters
pathWDL_String reference where the path will be put on success or empty string on failure

◆ HostPath()

void HostPath ( WDL_String &  path,
const char *  bundleID = 0 
)

Get the path to the host binary.

Parameters
pathWDL_String reference where the path will be put on success or empty string on failure

◆ INIPath()

void INIPath ( WDL_String &  path,
const char *  pluginName 
)

Get the path to the folder where the App's settings.ini file is stored.

Parameters
pathWDL_String reference where the path will be put on success or empty string on failure
pluginNameCString to specify the plug-in name (BUNDLE_NAME from config.h can be used here)

◆ LoadWinResource()

const void * LoadWinResource ( const char *  resID,
const char *  type,
int &  sizeInBytes,
void *  pHInstance 
)

Load a resource from the binary (windows only).

Parameters
typeThe resource type in lower or upper case, e.g. ttf or TTF for a truetype font
Returns
const void pointer to the data if successfull on windows. Returns nullptr if unsuccessfull or on platforms other than windows

Referenced by IGraphicsNanoVG::LoadAPIBitmap(), IGraphicsSkia::LoadAPIBitmap(), and IGraphics::LoadResource().

◆ LocateResource()

EResourceLocation LocateResource ( const char *  fileNameOrResID,
const char *  type,
WDL_String &  result,
const char *  bundleID,
void *  pHInstance,
const char *  sharedResourcesSubPath 
)

Find the absolute path of a resource based on it's file name (e.g.

“background.png”) and type (e.g. “png”), or in the case of windows, confirm the existence of a particular resource in the binary. If it fails to find the resource with the binary it will test the fileNameOrResID argument as an absolute path, to see if the file exists in that place. On macOS resources are usually included inside the bundle resources folder. On Windows resources are usually baked into the binary via the resource compiler. In this case the fileName argument is the resource id to look for. The .rc file must include these ids, otherwise you may hit a runtime assertion when you come to load the file. In some cases you may want to provide an absolute path to a file in a shared resources folder here (for example if you want to reduce the disk footprint of multiple bundles, such as when you have multiple plug-in formats installed).

Parameters
fileNameOrResIDThe filename or resourceID including extension. If no resource is found this argument is tested as an absolute path.
typeThe resource type (file extension) in lower or upper case, e.g. ttf or TTF for a truetype font
resultWDL_String which will either contain the full path to the resource on disk, or the full Windows resourceID on success
Returns
true on success

Referenced by IGraphics::LoadResource(), and IGraphics::SearchImageResource().

◆ PluginPath()

void PluginPath ( WDL_String &  path,
PluginIDType  pExtra 
)

Get the path to the plug-in binary.

Parameters
pathWDL_String reference where the path will be put on success or empty string on failure
pExtraThis should either be a const char* to bundleID (macOS) or an HMODULE handle (windows)

◆ UserHomePath()

void UserHomePath ( WDL_String &  path)
Parameters
pathWDL_String reference where the path will be put on success or empty string on failure

◆ VST3PresetsPath()

void VST3PresetsPath ( WDL_String &  path,
const char *  mfrName,
const char *  pluginName,
bool  isSystem = true 
)
Parameters
pathWDL_String reference where the path will be put on success or empty string on failure
mfrNameCString to specify the manufacturer name, which will be the top level folder for .vstpreset files for this manufacturer's product
pluginNameCString to specify the plug-in name, which will be the sub folder (beneath mfrName) in which the .vstpreset files are located
isSystemSet true if you want to obtain the system-wide path, otherwise the path will be in the user's home folder