Skip to content

Commit

Permalink
Resource compiler now takes --db, --data, and --data-src argume…
Browse files Browse the repository at this point in the history
…nts.
  • Loading branch information
mtwilliams committed Mar 27, 2016
1 parent 961eba6 commit bb84d7c
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions tools/resource_compiler/src/yeti/resource_compiler/runner.cc
Expand Up @@ -27,18 +27,36 @@ Runner::~Runner() {
}

void Runner::setup(const char *args[], const u32 num_args) {
YETI_UNUSED(args);
YETI_UNUSED(num_args);
ResourceCompiler::Path resource_database_path;
ResourceCompiler::Path data_path;
ResourceCompiler::Path source_data_path;

ResourceCompiler::Path cwd;
foundation::path::cwd(&cwd[0], sizeof(cwd));

ResourceCompiler::Path resource_database_path;
sprintf(&resource_database_path[0], "%s/resources.db", &cwd[0]);
resource_compiler_opts_.db = (ResourceDatabase *)~NULL; // ResourceDatabase::open(&resource_database_path[0]);
sprintf(&data_path[0], "%s/data", &cwd[0]);
sprintf(&source_data_path[0], "%s/data_src", &cwd[0]);

for (const char **arg = &args[0], **end = &args[num_args]; arg < end; ++arg) {
if (strcmp(*arg, "--db") == 0)
sprintf(&resource_database_path[0], "%s/%s", cwd, *++arg);
else if (strcmp(*arg, "--data") == 0)
sprintf(&data_path[0], "%s/%s", cwd, *++arg);
else if (strcmp(*arg, "--data-src") == 0)
sprintf(&source_data_path[0], "%s/%s", cwd, *++arg);
else
yeti_assertf(0, "Unknown command-line argument '%s'.", *arg);
}

foundation::path::canonicalize(&resource_database_path[0]);
foundation::path::canonicalize(&data_path[0]);
foundation::path::canonicalize(&source_data_path[0]);

sprintf(&resource_compiler_opts_.data[0], "%s/data", &cwd[0]);
sprintf(&resource_compiler_opts_.data_src[0], "%s/data_src", &cwd[0]);
// resource_compiler_opts_.db = ResourceDatabase::open(&resource_database_path[0]);
resource_compiler_opts_.db = (ResourceDatabase *)~NULL;
memcpy((void *)&resource_compiler_opts_.data[0], (const void *)&data_path[0], sizeof(data_path));
memcpy((void *)&resource_compiler_opts_.data_src[0], (const void *)&source_data_path[0], sizeof(source_data_path));
}

void Runner::run() {
Expand Down

0 comments on commit bb84d7c

Please sign in to comment.