| 86 | } |
| 87 | |
| 88 | std::string ofToDataPath(const std::string& path) |
| 89 | { |
| 90 | if (!path.empty() && (path[0] == '.' || juce::File::isAbsolutePath(path))) |
| 91 | return path; |
| 92 | |
| 93 | static const auto sDataDir = [] |
| 94 | { |
| 95 | auto defaultDataDir = juce::File::getSpecialLocation(juce::File::userDocumentsDirectory).getChildFile("BespokeSynth").getFullPathName().toStdString(); |
| 96 | auto dataDir = juce::SystemStats::getEnvironmentVariable("BESPOKE_DATA_DIR", defaultDataDir).toStdString(); |
| 97 | #if BESPOKE_WINDOWS |
| 98 | std::replace(begin(dataDir), end(dataDir), '\\', '/'); |
| 99 | #endif |
| 100 | UpdateUserData(dataDir); |
| 101 | dataDir += '/'; |
| 102 | return dataDir; |
| 103 | }(); |
| 104 | |
| 105 | return sDataDir + path; |
| 106 | } |
| 107 | |
| 108 | std::string ofToFactoryPath(const std::string& subdir) |
| 109 | { |
no test coverage detected