Sampler files path locations - OS X + Windows

Hi!

I have made a sampler plugin that reads .wav files from the drive. The path im using for Mac OS X is:
File::getSpecialLocation(File::SpecialLocationType::commonApplicationDataDirectory).getChildFile("Application Support").getChildFile("Company").getChildFile("File")).

Is this a correct path to use? Also, what path do I use for Windows? Im assuming not the same one.

Do I check what operating system to use in the code? Or export different versions with their own paths for each?

Yes, that is a sensible choice. With the exception that for Windows you skip the “Application Support” part:

File::getSpecialLocation(File::SpecialLocationType::commonApplicationDataDirectory)
#if JUCE_MAC
    .getChildFile("Application Support")
#endif
    .getChildFile("Company").getChildFile("File"));

The if JUCE_MAC is evaluated by the preprocessor at compile time, since the build will always only run on the machine it was compiled for.

2 Likes

Thank you! Exactly what I was looking for!