| @@ -744,7 +744,7 @@ void LatestVersionChecker::askUserForLocationToDownload (URL& newVersionToDownlo | |||||
| { | { | ||||
| File targetFolder (EnabledModuleList::findGlobalModulesFolder()); | File targetFolder (EnabledModuleList::findGlobalModulesFolder()); | ||||
| if (isJuceModulesFolder (targetFolder)) | |||||
| if (isJUCEModulesFolder (targetFolder)) | |||||
| targetFolder = targetFolder.getParentDirectory(); | targetFolder = targetFolder.getParentDirectory(); | ||||
| FileChooser chooser (TRANS("Please select the location into which you'd like to install the new version"), | FileChooser chooser (TRANS("Please select the location into which you'd like to install the new version"), | ||||
| @@ -754,7 +754,7 @@ void LatestVersionChecker::askUserForLocationToDownload (URL& newVersionToDownlo | |||||
| { | { | ||||
| targetFolder = chooser.getResult(); | targetFolder = chooser.getResult(); | ||||
| if (isJuceModulesFolder (targetFolder)) | |||||
| if (isJUCEModulesFolder (targetFolder)) | |||||
| targetFolder = targetFolder.getParentDirectory(); | targetFolder = targetFolder.getParentDirectory(); | ||||
| if (targetFolder.getChildFile ("JUCE").isDirectory()) | if (targetFolder.getChildFile ("JUCE").isDirectory()) | ||||
| @@ -772,7 +772,7 @@ void LatestVersionChecker::askUserForLocationToDownload (URL& newVersionToDownlo | |||||
| return; | return; | ||||
| } | } | ||||
| if (isJuceFolder (targetFolder)) | |||||
| if (isJUCEFolder (targetFolder)) | |||||
| { | { | ||||
| if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, | if (! AlertWindow::showOkCancelBox (AlertWindow::WarningIcon, | ||||
| TRANS("Overwrite existing JUCE folder?"), | TRANS("Overwrite existing JUCE folder?"), | ||||
| @@ -99,14 +99,6 @@ namespace | |||||
| return files; | return files; | ||||
| } | } | ||||
| static String joinLinesIntoSourceFile (StringArray& lines) | |||||
| { | |||||
| while (lines.size() > 10 && lines [lines.size() - 1].isEmpty()) | |||||
| lines.remove (lines.size() - 1); | |||||
| return lines.joinIntoString (getLineEnding()) + getLineEnding(); | |||||
| } | |||||
| static void replaceFile (const File& file, const String& newText, const String& message) | static void replaceFile (const File& file, const String& newText, const String& message) | ||||
| { | { | ||||
| std::cout << message << file.getFullPathName() << std::endl; | std::cout << message << file.getFullPathName() << std::endl; | ||||
| @@ -371,7 +363,7 @@ namespace | |||||
| for (int i = 0; i < lines.size(); ++i) | for (int i = 0; i < lines.size(); ++i) | ||||
| { | { | ||||
| String& line = lines.getReference(i); | |||||
| String& line = lines.getReference (i); | |||||
| if (options.removeTabs && line.containsChar ('\t')) | if (options.removeTabs && line.containsChar ('\t')) | ||||
| { | { | ||||
| @@ -380,6 +372,7 @@ namespace | |||||
| for (;;) | for (;;) | ||||
| { | { | ||||
| const int tabPos = line.indexOfChar ('\t'); | const int tabPos = line.indexOfChar ('\t'); | ||||
| if (tabPos < 0) | if (tabPos < 0) | ||||
| break; | break; | ||||
| @@ -761,7 +754,7 @@ namespace | |||||
| { | { | ||||
| hideDockIcon(); | hideDockIcon(); | ||||
| const String appName (JUCEApplication::getInstance()->getApplicationName()); | |||||
| auto appName = JUCEApplication::getInstance()->getApplicationName(); | |||||
| std::cout << appName << std::endl | std::cout << appName << std::endl | ||||
| << std::endl | << std::endl | ||||
| @@ -111,7 +111,7 @@ public: | |||||
| void refreshModuleInfoIfCurrentlyShowing (bool juceModulePathChanged) | void refreshModuleInfoIfCurrentlyShowing (bool juceModulePathChanged) | ||||
| { | { | ||||
| auto isJuceModule = EnabledModuleList::isJuceModule (moduleID); | |||||
| auto isJuceModule = isJUCEModule (moduleID); | |||||
| auto shouldRefresh = (juceModulePathChanged && isJuceModule) || (! juceModulePathChanged && ! isJuceModule); | auto shouldRefresh = (juceModulePathChanged && isJuceModule) || (! juceModulePathChanged && ! isJuceModule); | ||||
| if (! shouldRefresh) | if (! shouldRefresh) | ||||
| @@ -170,8 +170,8 @@ private: | |||||
| if (exporter->isCLion()) | if (exporter->isCLion()) | ||||
| continue; | continue; | ||||
| auto key = modules.isJuceModule (moduleID) ? Ids::defaultJuceModulePath | |||||
| : Ids::defaultUserModulePath; | |||||
| auto key = isJUCEModule (moduleID) ? Ids::defaultJuceModulePath | |||||
| : Ids::defaultUserModulePath; | |||||
| Value src (modulePathValueSources.add (new DependencyPathValueSource (exporter->getPathForModuleValue (moduleID), | Value src (modulePathValueSources.add (new DependencyPathValueSource (exporter->getPathForModuleValue (moduleID), | ||||
| key, exporter->getTargetOSForExporter()))); | key, exporter->getTargetOSForExporter()))); | ||||
| @@ -30,11 +30,6 @@ | |||||
| #include "../ProjectSaving/jucer_ProjectExport_Xcode.h" | #include "../ProjectSaving/jucer_ProjectExport_Xcode.h" | ||||
| //============================================================================== | //============================================================================== | ||||
| static String trimCommentCharsFromStartOfLine (const String& line) | |||||
| { | |||||
| return line.trimStart().trimCharactersAtStart ("*/").trimStart(); | |||||
| } | |||||
| static var parseModuleDesc (const StringArray& lines) | static var parseModuleDesc (const StringArray& lines) | ||||
| { | { | ||||
| DynamicObject* o = new DynamicObject(); | DynamicObject* o = new DynamicObject(); | ||||
| @@ -735,7 +730,7 @@ File EnabledModuleList::getModuleFolder (const String& moduleID) | |||||
| { | { | ||||
| if (shouldUseGlobalPath (moduleID)) | if (shouldUseGlobalPath (moduleID)) | ||||
| { | { | ||||
| if (isJuceModule (moduleID)) | |||||
| if (isJUCEModule (moduleID)) | |||||
| return getModuleFolderFromPathIfItExists (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString(), moduleID, project); | return getModuleFolderFromPathIfItExists (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString(), moduleID, project); | ||||
| return findUserModuleFolder (getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString(), moduleID); | return findUserModuleFolder (getAppSettings().getStoredPath (Ids::defaultUserModulePath).toString(), moduleID); | ||||
| @@ -940,36 +935,6 @@ File EnabledModuleList::findDefaultModulesFolder (Project& project) | |||||
| return File::getCurrentWorkingDirectory(); | return File::getCurrentWorkingDirectory(); | ||||
| } | } | ||||
| bool EnabledModuleList::isJuceModule (const String& moduleID) | |||||
| { | |||||
| static StringArray juceModuleIds = | |||||
| { | |||||
| "juce_analytics", | |||||
| "juce_audio_basics", | |||||
| "juce_audio_devices", | |||||
| "juce_audio_formats", | |||||
| "juce_audio_plugin_client", | |||||
| "juce_audio_processors", | |||||
| "juce_audio_utils", | |||||
| "juce_blocks_basics", | |||||
| "juce_box2d", | |||||
| "juce_core", | |||||
| "juce_cryptography", | |||||
| "juce_data_structures", | |||||
| "juce_dsp", | |||||
| "juce_events", | |||||
| "juce_graphics", | |||||
| "juce_gui_basics", | |||||
| "juce_gui_extra", | |||||
| "juce_opengl", | |||||
| "juce_osc", | |||||
| "juce_product_unlocking", | |||||
| "juce_video" | |||||
| }; | |||||
| return juceModuleIds.contains (moduleID); | |||||
| } | |||||
| void EnabledModuleList::addModuleFromUserSelectedFile() | void EnabledModuleList::addModuleFromUserSelectedFile() | ||||
| { | { | ||||
| static auto lastLocation = findDefaultModulesFolder (project); | static auto lastLocation = findDefaultModulesFolder (project); | ||||
| @@ -1030,12 +995,12 @@ void EnabledModuleList::addModuleOfferingToCopy (const File& f, bool isFromUserS | |||||
| : areMostModulesUsingGlobalPath()); | : areMostModulesUsingGlobalPath()); | ||||
| } | } | ||||
| bool isJuceFolder (const File& f) | |||||
| bool isJUCEFolder (const File& f) | |||||
| { | { | ||||
| return isJuceModulesFolder (f.getChildFile ("modules")); | |||||
| return isJUCEModulesFolder (f.getChildFile ("modules")); | |||||
| } | } | ||||
| bool isJuceModulesFolder (const File& f) | |||||
| bool isJUCEModulesFolder (const File& f) | |||||
| { | { | ||||
| return f.isDirectory() && f.getChildFile ("juce_core").isDirectory(); | return f.isDirectory() && f.getChildFile ("juce_core").isDirectory(); | ||||
| } | } | ||||
| @@ -31,8 +31,8 @@ class ProjectExporter; | |||||
| class ProjectSaver; | class ProjectSaver; | ||||
| //============================================================================== | //============================================================================== | ||||
| bool isJuceModulesFolder (const File&); | |||||
| bool isJuceFolder (const File&); | |||||
| bool isJUCEModulesFolder (const File&); | |||||
| bool isJUCEFolder (const File&); | |||||
| //============================================================================== | //============================================================================== | ||||
| struct ModuleDescription | struct ModuleDescription | ||||
| @@ -140,7 +140,6 @@ public: | |||||
| static File findGlobalModulesFolder(); | static File findGlobalModulesFolder(); | ||||
| static File findDefaultModulesFolder (Project&); | static File findDefaultModulesFolder (Project&); | ||||
| static bool isJuceModule (const String& moduleID); | |||||
| bool isModuleEnabled (const String& moduleID) const; | bool isModuleEnabled (const String& moduleID) const; | ||||
| @@ -516,8 +516,8 @@ String ProjectExporter::getPathForModuleString (const String& moduleID) const | |||||
| if (exporterPath.isEmpty() || project.getModules().shouldUseGlobalPath (moduleID)) | if (exporterPath.isEmpty() || project.getModules().shouldUseGlobalPath (moduleID)) | ||||
| { | { | ||||
| auto id = EnabledModuleList::isJuceModule (moduleID) ? Ids::defaultJuceModulePath | |||||
| : Ids::defaultUserModulePath; | |||||
| auto id = isJUCEModule (moduleID) ? Ids::defaultJuceModulePath | |||||
| : Ids::defaultUserModulePath; | |||||
| if (TargetOS::getThisOS() != getTargetOSForExporter()) | if (TargetOS::getThisOS() != getTargetOSForExporter()) | ||||
| return getAppSettings().getFallbackPathForOS (id, getTargetOSForExporter()).toString(); | return getAppSettings().getFallbackPathForOS (id, getTargetOSForExporter()).toString(); | ||||
| @@ -27,6 +27,21 @@ | |||||
| #include "../../Application/jucer_Headers.h" | #include "../../Application/jucer_Headers.h" | ||||
| //============================================================================== | //============================================================================== | ||||
| const char* getLineEnding() { return "\r\n"; } | |||||
| String joinLinesIntoSourceFile (StringArray& lines) | |||||
| { | |||||
| while (lines.size() > 10 && lines [lines.size() - 1].isEmpty()) | |||||
| lines.remove (lines.size() - 1); | |||||
| return lines.joinIntoString (getLineEnding()) + getLineEnding(); | |||||
| } | |||||
| String trimCommentCharsFromStartOfLine (const String& line) | |||||
| { | |||||
| return line.trimStart().trimCharactersAtStart ("*/").trimStart(); | |||||
| } | |||||
| String createAlphaNumericUID() | String createAlphaNumericUID() | ||||
| { | { | ||||
| String uid; | String uid; | ||||
| @@ -275,3 +290,34 @@ bool fileNeedsCppSyntaxHighlighting (const File& file) | |||||
| return CharPointer_UTF8::isValidString (fileStart, sizeof (fileStart)) | return CharPointer_UTF8::isValidString (fileStart, sizeof (fileStart)) | ||||
| && String (fileStart).trimStart().startsWith ("// -*- C++ -*-"); | && String (fileStart).trimStart().startsWith ("// -*- C++ -*-"); | ||||
| } | } | ||||
| //============================================================================== | |||||
| bool isJUCEModule (const String& moduleID) noexcept | |||||
| { | |||||
| static StringArray juceModuleIds = | |||||
| { | |||||
| "juce_analytics", | |||||
| "juce_audio_basics", | |||||
| "juce_audio_devices", | |||||
| "juce_audio_formats", | |||||
| "juce_audio_plugin_client", | |||||
| "juce_audio_processors", | |||||
| "juce_audio_utils", | |||||
| "juce_blocks_basics", | |||||
| "juce_box2d", | |||||
| "juce_core", | |||||
| "juce_cryptography", | |||||
| "juce_data_structures", | |||||
| "juce_dsp", | |||||
| "juce_events", | |||||
| "juce_graphics", | |||||
| "juce_gui_basics", | |||||
| "juce_gui_extra", | |||||
| "juce_opengl", | |||||
| "juce_osc", | |||||
| "juce_product_unlocking", | |||||
| "juce_video" | |||||
| }; | |||||
| return juceModuleIds.contains (moduleID); | |||||
| } | |||||
| @@ -28,6 +28,11 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| const char* getLineEnding(); | |||||
| String joinLinesIntoSourceFile (StringArray& lines); | |||||
| String trimCommentCharsFromStartOfLine (const String& line); | |||||
| String hexString8Digits (int value); | String hexString8Digits (int value); | ||||
| String createAlphaNumericUID(); | String createAlphaNumericUID(); | ||||
| @@ -53,6 +58,8 @@ void addPlistDictionaryKeyInt (XmlElement* xml, const String& key, int value); | |||||
| bool fileNeedsCppSyntaxHighlighting (const File& file); | bool fileNeedsCppSyntaxHighlighting (const File& file); | ||||
| bool isJUCEModule (const String& moduleID) noexcept; | |||||
| //============================================================================== | //============================================================================== | ||||
| int indexOfLineStartingWith (const StringArray& lines, const String& text, int startIndex); | int indexOfLineStartingWith (const StringArray& lines, const String& text, int startIndex); | ||||
| @@ -91,7 +91,7 @@ public: | |||||
| if (! fc.browseForDirectory()) | if (! fc.browseForDirectory()) | ||||
| return false; | return false; | ||||
| if (isJuceModulesFolder (fc.getResult())) | |||||
| if (isJUCEModulesFolder (fc.getResult())) | |||||
| { | { | ||||
| result = fc.getResult(); | result = fc.getResult(); | ||||
| return true; | return true; | ||||
| @@ -406,7 +406,7 @@ public: | |||||
| wizard->modulesFolder = modulesPathBox.isUsingGlobalPaths ? File (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString()) | wizard->modulesFolder = modulesPathBox.isUsingGlobalPaths ? File (getAppSettings().getStoredPath (Ids::defaultJuceModulePath).toString()) | ||||
| : modulesPathBox.modulesFolder; | : modulesPathBox.modulesFolder; | ||||
| if (! isJuceModulesFolder (wizard->modulesFolder)) | |||||
| if (! isJUCEModulesFolder (wizard->modulesFolder)) | |||||
| { | { | ||||
| if (modulesPathBox.isUsingGlobalPaths) | if (modulesPathBox.isUsingGlobalPaths) | ||||
| AlertWindow::showMessageBox (AlertWindow::AlertIconType::WarningIcon, "Invalid Global Path", | AlertWindow::showMessageBox (AlertWindow::AlertIconType::WarningIcon, "Invalid Global Path", | ||||