Best place to put sample data on windows/OS X


#1

What would be the recommended path to store audio sample data that is used by my plugin?
I tried File::SpecialLocationType::globalApplicationsDirectory/… but that won’t work under windows since it points to two different directories depending on the application target platform
(/Program Files vs /Program Files (x86))
I have now switched to commonApplicationDataDirectory. Would that also be the right choice in OS X?


#2

My first idea would be to store the data per user, i.e. in File::SpecialLocationType::userApplicationDataDirectory. But maybe you can elaborate on what kind of audio sample data you want to store and when you want to store it (when opening the plugin, when saving presets, when recording, …) to help find the best location.


#3

Sure! The plugin synth uses a fixed choice of Audio sample sets.
These are provided with the installation of the plugin and can not be modified by the user.

I am now loading the samples from:
File::getSpecialLocation(File::SpecialLocationType::commonApplicationDataDirectory)
.getChildFile(“Manufacturer”)
.getChildFile(“PluginName”)
.getChildFile(“PluginName.dat”);

Which under my current Windows 7 Installation resolves to:
C:\ProgramData\Manufacturer\PluginName\PluginName.dat

Under Windows this solves the issue for me.

Note that the JUCE api documentation states a different path for the commonApplicationDataDirectory special folder:
’… on Windows, it could be something like “\Documents and Settings\All Users\Application Data”.'
I just hope that the special folder path is consistent with all windows versions that I am planning to support (Win7, 8, 10 - x64 and x86)

Only thing I need to know now is wether this would also be the appropriate choice in OS X.


#4

Yes it is. It expands to “/Library/Application Support”, so you can use the same child files here. And the user one expands to “~/Library/Application Support”.
The consistency is not a problem, if you always access it using the juce methods, that’s what they are there for. Only trouble is, if you place the data from an installer, that one will have to predict the path juce will expand to.

AFAIK this hasn’t changed since the beginning of OSX, but I started with 10.6, so take it with a shadow of a doubt :wink:


#5

Yep, that’s why I mentioned the difference between the documented and actual file path.