diff --git a/SourceSampler/Source/SourceSampler.cpp b/SourceSampler/Source/SourceSampler.cpp index 70cbae1..6f526e2 100644 --- a/SourceSampler/Source/SourceSampler.cpp +++ b/SourceSampler/Source/SourceSampler.cpp @@ -20,7 +20,7 @@ SourceSampler::SourceSampler(): serverInterface ([this]{return getGlobalContext();}) { std::cout << "Creating needed directories" << std::endl; - createDirectories(); + createDirectories(APP_DIRECTORY_NAME); std::cout << "Configuring app" << std::endl; if(audioFormatManager.getNumKnownFormats() == 0){ audioFormatManager.registerBasicFormats(); } @@ -120,7 +120,7 @@ void SourceSampler::bindState() sounds = std::make_unique(state.getChildWithName(SourceIDs::PRESET), [this]{return getGlobalContext();}); } -void SourceSampler::createDirectories() +void SourceSampler::createDirectories(const juce::String& appDirectoryName) { #if ELK_BUILD sourceDataLocation = juce::File(ELK_SOURCE_DATA_BASE_LOCATION); @@ -128,10 +128,10 @@ void SourceSampler::createDirectories() presetFilesLocation = juce::File(ELK_SOURCE_PRESETS_LOCATION); tmpFilesLocation = juce::File(ELK_SOURCE_TMP_LOCATION); #else - sourceDataLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile("SourceSampler/"); - soundsDownloadLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile("SourceSampler/sounds"); - presetFilesLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile("SourceSampler/presets"); - tmpFilesLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile("SourceSampler/tmp"); + sourceDataLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile(appDirectoryName); + soundsDownloadLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile(appDirectoryName + "/sounds"); + presetFilesLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile(appDirectoryName + "/presets"); + tmpFilesLocation = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile(appDirectoryName + "/tmp"); #endif if (!sourceDataLocation.exists()){ diff --git a/SourceSampler/Source/SourceSampler.h b/SourceSampler/Source/SourceSampler.h index 16cfce0..14ca141 100644 --- a/SourceSampler/Source/SourceSampler.h +++ b/SourceSampler/Source/SourceSampler.h @@ -36,7 +36,7 @@ class SourceSampler: public juce::ActionBroadcaster, void bindState(); GlobalContextStruct getGlobalContext(); - void createDirectories(); + void createDirectories(const juce::String& appDirectoryName); //============================================================================== void prepareToPlay (double sampleRate, int samplesPerBlock); diff --git a/SourceSampler/Source/defines_source.h b/SourceSampler/Source/defines_source.h index acfc513..25ae8e1 100644 --- a/SourceSampler/Source/defines_source.h +++ b/SourceSampler/Source/defines_source.h @@ -30,6 +30,7 @@ #define MAIN_TIMER_HZ 15 // Run main timer tasks at this rate (this includes removing sounds that need to be removed and possibly other tasks) #define SAFE_SOUND_DELETION_TIME_MS 200 +#define APP_DIRECTORY_NAME "SourceSampler" // Note this is ignored in ELK builds #define ELK_SOURCE_DATA_BASE_LOCATION "/udata/source/" #define ELK_SOURCE_SOUNDS_LOCATION "/udata/source/sounds/" #define ELK_SOURCE_PRESETS_LOCATION "/udata/source/presets/"