File findDefaultModulesFolder (bool mustContainJuceCoreModule) { const MainWindowList& windows = IntrojucerApp::getApp().mainWindowList; for (int i = windows.windows.size(); --i >= 0;) { if (Project* p = windows.windows.getUnchecked (i)->getProject()) { const File f (EnabledModuleList::findDefaultModulesFolder (*p)); if (isJuceModulesFolder (f) || (f.isDirectory() && ! mustContainJuceCoreModule)) return f; } } if (mustContainJuceCoreModule) return findDefaultModulesFolder (false); File f (File::getSpecialLocation (File::currentApplicationFile)); for (;;) { File parent (f.getParentDirectory()); if (parent == f || ! parent.isDirectory()) break; if (isJuceFolder (parent)) return parent.getChildFile ("modules"); f = parent; } return File::nonexistent; }
static const File lookInFolderForJuceFolder (const File& folder) { for (DirectoryIterator di (folder, false, "*juce*", File::findDirectories); di.next();) { if (isJuceFolder (di.getFile())) return di.getFile(); } return File::nonexistent; }
const File findParentJuceFolder (const File& file) { File f (file); while (f.exists() && f.getParentDirectory() != f) { if (isJuceFolder (f)) return f; File found = lookInFolderForJuceFolder (f); if (found.exists()) return found; f = f.getParentDirectory(); } return File::nonexistent; }