Browse Source

Fixed a typo in the introjucer.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
dab3472756
4 changed files with 61 additions and 8 deletions
  1. +46
    -4
      extras/Introjucer/Source/Application/jucer_CommandLine.cpp
  2. +3
    -4
      extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h
  3. +10
    -0
      extras/Introjucer/Source/Project/jucer_Project.cpp
  4. +2
    -0
      extras/Introjucer/Source/Project/jucer_Project.h

+ 46
- 4
extras/Introjucer/Source/Application/jucer_CommandLine.cpp View File

@@ -36,6 +36,17 @@ namespace
return File::getCurrentWorkingDirectory().getChildFile (filename.unquoted());
}
bool checkArgumentCount (const StringArray& tokens, int minNumArgs)
{
if (tokens.size() < minNumArgs)
{
std::cout << "Not enough arguments!" << std::endl;
return false;
}
return true;
}
//==============================================================================
/* Running a command-line of the form "introjucer --resave foobar.jucer" will try to load
that project and re-export all of its targets.
@@ -125,11 +136,8 @@ namespace
int buildModules (const StringArray& tokens, const bool buildAllWithIndex)
{
if (tokens.size() < 3)
{
std::cout << "Not enough arguments!" << std::endl;
if (! checkArgumentCount (tokens, 3))
return 1;
}
const File targetFolder (getFile (tokens[1]));
@@ -196,6 +204,37 @@ namespace
return 0;
}
int showStatus (const StringArray& tokens)
{
if (! checkArgumentCount (tokens, 2))
return 1;
const File projectFile (getFile (tokens[1]));
Project proj (projectFile);
if (proj.loadDocument (projectFile).isNotEmpty())
{
std::cout << "Failed to load project: " << projectFile.getFullPathName() << std::endl;
return 1;
}
std::cout << "Project file: " << projectFile.getFullPathName() << std::endl
<< "Name: " << proj.getProjectName().toString() << std::endl
<< "UID: " << proj.getProjectUID() << std::endl;
const int numModules = proj.getNumModules();
if (numModules > 0)
{
std::cout << "Modules:" << std::endl;
for (int i = 0; i < numModules; ++i)
std::cout << " " << proj.getModuleID (i) << std::endl;
}
return 0;
}
}
//==============================================================================
@@ -217,5 +256,8 @@ int performCommandLine (const String& commandLine)
if (tokens[0] == "listmodules")
return listModules();
if (tokens[0] == "status")
return showStatus (tokens);
return commandLineNotPerformed;
}

+ 3
- 4
extras/Introjucer/Source/Project Saving/jucer_ProjectSaver.h View File

@@ -196,7 +196,7 @@ private:
static bool shouldFileBeKept (const String& filename)
{
const char* filesToKeep = { ".svn", ".cvs", "CMakeLists.txt" };
const char* filesToKeep[] = { ".svn", ".cvs", "CMakeLists.txt" };
for (int i = 0; i < numElementsInArray (filesToKeep); ++i)
if (filename == filesToKeep[i])
@@ -256,9 +256,8 @@ private:
const String headerGuard ("__JUCE_APPCONFIG_" + project.getProjectUID().toUpperCase() + "__");
out << "#ifndef " << headerGuard << newLine
<< "#define " << headerGuard << newLine
<< newLine;
out << "//==============================================================================" << newLine;
<< newLine
<< "//==============================================================================" << newLine;
const int longestName = findLongestModuleName (modules);


+ 10
- 0
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -878,6 +878,16 @@ void Project::createRequiredModules (const ModuleList& availableModules, OwnedAr
modules.add (availableModules.modules.getUnchecked(i)->create());
}
int Project::getNumModules() const
{
return projectRoot.getChildWithName (Tags::modulesGroup).getNumChildren();
}
String Project::getModuleID (int index) const
{
return projectRoot.getChildWithName (Tags::modulesGroup).getChild (index) [Ids::id_].toString();
}
//==============================================================================
ValueTree Project::getConfigurations() const
{


+ 2
- 0
extras/Introjucer/Source/Project/jucer_Project.h View File

@@ -275,6 +275,8 @@ public:
void addModule (const String& moduleID);
void removeModule (const String& moduleID);
int getNumModules() const;
String getModuleID (int index) const;
void createRequiredModules (const ModuleList& availableModules, OwnedArray<LibraryModule>& modules) const;


Loading…
Cancel
Save