Binary resources not in Binary Data

I've got my samplesynth to build on MacOS but it won't run, as it can't find "rawwaves" directory which contains some raw files for STK. I could try to modify STK to use JUCE's binary data, but isn't it possible to simply point STK at the right directory?

Like Contents/Resources/rawwaves?

What do I need to set Stk::setRawwaves(...); I tried simply Stk::setRawwaves("rawwaves") which works for Windows (as long as the directory is in the same place as the .exe) but not for MacOS?

I've found an answer:


#ifdef JUCE_MAC
    File file = File::getSpecialLocation(File::currentApplicationFile);
    String appPath = file.getFullPathName();
    String rawwavesPath = appPath + "/Contents/Resources/rawwaves";

What I don't know how to do is make JUCE TheIntrojucer move the rawwaves directory to <app>/Contents/Resources, so that will have to be done manually.

Is this the general format for making code in your project execute only when being run on a specific platform?   i have some os x-specific code in mine, and am trying to compile on windows. 

Yes, but be careful - the code above is not strictly correct!

Always use:


and NOT:

#ifdef JUCE_MAC

Because sometimes these definitions could be explicitly set to 0 rather than just being left undefined.

(And this is true of ALL the macro flags that we use in JUCE!)