From 105929d39f1317533a1791e5ed5814c46f3b0732 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 20 Feb 2012 13:07:45 +0000 Subject: [PATCH] Introjucer: a few minor optimisations. --- .../Source/Project Saving/jucer_ProjectExport_XCode.h | 2 +- .../Source/Project Saving/jucer_ProjectExporter.cpp | 4 +--- extras/Introjucer/Source/Project/jucer_Module.cpp | 6 ++++-- extras/Introjucer/Source/Utility/jucer_RelativePath.h | 4 +++- modules/juce_core/text/juce_Identifier.h | 3 +++ 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index e283f58fc6..08857e6c64 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -865,7 +865,7 @@ private: public: static int compareElements (const ValueTree* first, const ValueTree* second) { - return first->getType().toString().compare (second->getType().toString()); + return first->getType().getCharPointer().compare (second->getType().getCharPointer()); } private: diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp index 6475cc85d4..3409c0b517 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExporter.cpp @@ -95,9 +95,7 @@ ProjectExporter* ProjectExporter::createNewExporter (Project& project, const Str ProjectExporter* ProjectExporter::createExporter (Project& project, const ValueTree& settings) { - ProjectExporter* exp = nullptr; - - if (exp == nullptr) exp = MSVCProjectExporterVC2005::createForSettings (project, settings); + ProjectExporter* exp = MSVCProjectExporterVC2005::createForSettings (project, settings); if (exp == nullptr) exp = MSVCProjectExporterVC2008::createForSettings (project, settings); if (exp == nullptr) exp = MSVCProjectExporterVC2010::createForSettings (project, settings); if (exp == nullptr) exp = XCodeProjectExporter ::createForSettings (project, settings); diff --git a/extras/Introjucer/Source/Project/jucer_Module.cpp b/extras/Introjucer/Source/Project/jucer_Module.cpp index 252e7e9562..08594747b6 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.cpp +++ b/extras/Introjucer/Source/Project/jucer_Module.cpp @@ -584,8 +584,10 @@ void LibraryModule::findWildcardMatches (const File& localModuleFolder, const St FileSorter sorter; DirectoryIterator iter (localModuleFolder.getChildFile (path), false, wildCard); - while (iter.next()) - if (! iter.getFile().isHidden()) + bool isHiddenFile; + + while (iter.next (nullptr, &isHiddenFile, nullptr, nullptr, nullptr, nullptr)) + if (! isHiddenFile) tempList.addSorted (sorter, iter.getFile()); result.addArray (tempList); diff --git a/extras/Introjucer/Source/Utility/jucer_RelativePath.h b/extras/Introjucer/Source/Utility/jucer_RelativePath.h index 288b0c2653..83a15c56cc 100644 --- a/extras/Introjucer/Source/Utility/jucer_RelativePath.h +++ b/extras/Introjucer/Source/Utility/jucer_RelativePath.h @@ -110,7 +110,9 @@ private: File getFakeFile() const { - return File::getCurrentWorkingDirectory().getChildFile (path); + // This method gets called very often, so we'll cache this directory. + static const File currentWorkingDirectory (File::getCurrentWorkingDirectory()); + return currentWorkingDirectory.getChildFile (path); } static bool isAbsolute (const String& path) diff --git a/modules/juce_core/text/juce_Identifier.h b/modules/juce_core/text/juce_Identifier.h index db2012f3e2..875b409004 100644 --- a/modules/juce_core/text/juce_Identifier.h +++ b/modules/juce_core/text/juce_Identifier.h @@ -78,6 +78,9 @@ public: /** Returns this identifier's raw string pointer. */ operator const String::CharPointerType() const noexcept { return name; } + /** Returns this identifier's raw string pointer. */ + const String::CharPointerType getCharPointer() const noexcept { return name; } + /** Checks a given string for characters that might not be valid in an Identifier. Since Identifiers are used as a script variables and XML attributes, they should only contain alphanumeric characters, underscores, or the '-' and ':' characters.