File::currentApplicationFile different in Debug vs Release


This is in an AAX Plug-in on Windows…

File fPath = File::getSpecialLocation (File::currentApplicationFile);

In Debug returns:

fPath: c:\Program Files\Common Files\Avid\Audio\Plug-Ins\PLUGIN_NAME.aaxplugin\Contents\x64\ PLUGIN_NAME.aaxplugin

but in Release returns:

fPath: C:\Program Files\Avid\Pro Tools Developer\ProTools.exe

Obviously I need to find the bundle location to access my Resource Images… so this breaks my Release code.



Note - The SDK examples do give us a file named AAX_PlugInBundleLocation.h/.cpp which does return the correct location if you need a reference.




In JUCE we rely on GetModuleHandle (nullptr) to get the current DLL module handle and then use GetModuleFileName to get the path of the dll. I have no idea why it would return something different in release or debug mode. I also tried this myself and can’t seem to reproduce this. Are you doing anything different in your release build? Maybe the PACE copy-protection is somehow muddling with the behaviour of GetModuleHandle (nullptr)?

In any case, I’ve just committed a more robust way of getting the current dll path to develop with commit 2d1532e.


Nothing different… just using the PT latest dev build… If I get time I’ll try and see if I can quantify the difference with some logging in the Debug vs. Release builds… in the meantime I’ll check out your new commit.