MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / ofToFactoryPath

Function ofToFactoryPath

Source/OpenFrameworksPort.cpp:108–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108std::string ofToFactoryPath(const std::string& subdir)
109{
110 std::string result;
111#if BESPOKE_MAC
112 auto resDir = juce::File::getSpecialLocation(juce::File::SpecialLocationType::currentApplicationFile).getChildFile("Contents/Resources").getChildFile(subdir);
113#else
114 auto resDir = juce::File::getSpecialLocation(juce::File::SpecialLocationType::currentExecutableFile).getSiblingFile(subdir);
115#if BESPOKE_LINUX
116 if (!resDir.isDirectory())
117 {
118 resDir = juce::File::getSpecialLocation(juce::File::SpecialLocationType::currentApplicationFile).getChildFile("../../share/BespokeSynth").getChildFile(subdir);
119 if (!resDir.isDirectory())
120 resDir = juce::File{ juce::CharPointer_UTF8{ Bespoke::CMAKE_INSTALL_PREFIX } }.getChildFile("share/BespokeSynth").getChildFile(subdir);
121 }
122#endif
123#endif
124 if (!resDir.isDirectory())
125 throw std::runtime_error{ "Application directory not found. Please reinstall Bespoke." };
126
127 result = resDir.getFullPathName().toStdString();
128#if BESPOKE_WINDOWS
129 std::replace(begin(result), end(result), '\\', '/');
130#endif
131 return result;
132}
133
134std::string ofToResourcePath(const std::string& path)
135{

Callers 2

ofToResourcePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected