diff options
author | Johannes Schickel | 2013-11-07 12:58:35 +0100 |
---|---|---|
committer | D G Turner | 2013-11-24 00:48:02 +0000 |
commit | 80136c1e51902d4c63264730e26a7b4aff35e829 (patch) | |
tree | 2c3d5bddb5768c3e32d0cd5ca201f0b7a7aa2834 /devtools | |
parent | ffce805fb2b116ef1d4f03540158d42b3fcd5e80 (diff) | |
download | scummvm-rg350-80136c1e51902d4c63264730e26a7b4aff35e829.tar.gz scummvm-rg350-80136c1e51902d4c63264730e26a7b4aff35e829.tar.bz2 scummvm-rg350-80136c1e51902d4c63264730e26a7b4aff35e829.zip |
DEVTOOLS: Make create_project sort SCUMM as first engine.
This makes create_project output consistent with configure output again.
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/create_project/config.h | 1 | ||||
-rw-r--r-- | devtools/create_project/create_project.cpp | 35 |
2 files changed, 34 insertions, 2 deletions
diff --git a/devtools/create_project/config.h b/devtools/create_project/config.h index 1a66edff93..9d4b101360 100644 --- a/devtools/create_project/config.h +++ b/devtools/create_project/config.h @@ -27,6 +27,7 @@ #define PROJECT_NAME "scummvm" // Used for folders, icons, resources and project/solution name #define LIBS_DEFINE "SCUMMVM_LIBS" // Name of the include environment variable #define REVISION_DEFINE "SCUMMVM_INTERNAL_REVISION" +#define FIRST_ENGINE "scumm" // Name of the engine which should be sorted as first element #define ENABLE_LANGUAGE_EXTENSIONS "" // Comma separated list of projects that need language extensions #define DISABLE_EDIT_AND_CONTINUE "tinsel,tony,scummvm" // Comma separated list of projects that need Edit&Continue to be disabled for co-routine support (the main project is automatically added) diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 3eba36e235..16b8e1d166 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -674,6 +674,19 @@ EngineDescList parseEngineConfigure(const std::string &engineDir); * the name of the second operand. "false" otherwise. */ bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right); + +#ifdef FIRST_ENGINE +/** + * Compares two FSNode entries in a strict-weak fashion based on engine name + * order. + * + * @param left The first operand. + * @param right The second operand. + * @return "true" when the name of the left operand is strictly smaller than + * the name of the second operand. "false" otherwise. + */ +bool compareEngineNames(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right); +#endif } // End of anonymous namespace EngineDescList parseEngines(const std::string &srcDir) { @@ -684,9 +697,15 @@ EngineDescList parseEngines(const std::string &srcDir) { FileList engineFiles = listDirectory(srcDir + "/engines/"); - // Sort file list alphabetically this allows for a nicer order in - // --list-engines output, for example. +#ifdef FIRST_ENGINE + // In case we want to sort an engine to the front of the list we will + // use some manual sorting predicate which assures that. + engineFiles.sort(&compareEngineNames); +#else + // Otherwise, we simply sort the file list alphabetically this allows + // for a nicer order in --list-engines output, for example. engineFiles.sort(&compareFSNode); +#endif for (FileList::const_iterator i = engineFiles.begin(), end = engineFiles.end(); i != end; ++i) { // Each engine requires its own sub directory thus we will skip all @@ -833,6 +852,18 @@ EngineDescList parseEngineConfigure(const std::string &engineDir) { bool compareFSNode(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right) { return left.name < right.name; } + +#ifdef FIRST_ENGINE +bool compareEngineNames(const CreateProjectTool::FSNode &left, const CreateProjectTool::FSNode &right) { + if (left.name == FIRST_ENGINE) { + return right.name != FIRST_ENGINE; + } else if (right.name == FIRST_ENGINE) { + return false; + } else { + return compareFSNode(left, right); + } +} +#endif } // End of anonymous namespace TokenList tokenize(const std::string &input, char separator) { |