mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 08:27:42 +00:00
Use UTF-8 exclusively internally
This removes SystemString, SystemChar, etc. All filepaths and log strings are assumed to be UTF-8, with conversions to UTF-16 for Windows APIs as appropriate. Updates amuse, athena, boo, kabufua and nod
This commit is contained in:
@@ -21,8 +21,8 @@ class ToolPackage final : public ToolBase {
|
||||
|
||||
void CheckFile(const hecl::ProjectPath& path) {
|
||||
auto lastComp = path.getLastComponent();
|
||||
if (hecl::StringUtils::BeginsWith(lastComp, _SYS_STR("!world")) &&
|
||||
hecl::StringUtils::EndsWith(lastComp, _SYS_STR(".blend")))
|
||||
if (hecl::StringUtils::BeginsWith(lastComp, "!world") &&
|
||||
hecl::StringUtils::EndsWith(lastComp, ".blend"))
|
||||
AddSelectedItem(path);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ class ToolPackage final : public ToolBase {
|
||||
* and no nested !world.blend files == General PAK */
|
||||
if (checkGeneral && origSize == m_selectedItems.size()) {
|
||||
auto pathComps = path.getPathComponents();
|
||||
if (pathComps.size() == 2 && pathComps[0] != _SYS_STR("out") && pathComps[1] != _SYS_STR("Shared") &&
|
||||
pathComps[0].find(_SYS_STR(".app")) == hecl::SystemString::npos)
|
||||
if (pathComps.size() == 2 && pathComps[0] != "out" && pathComps[1] != "Shared" &&
|
||||
pathComps[0].find(".app") == std::string::npos)
|
||||
AddSelectedItem(path);
|
||||
}
|
||||
}
|
||||
@@ -62,14 +62,14 @@ public:
|
||||
if (info.args.size()) {
|
||||
/* See if project path is supplied via args and use that over the getcwd one */
|
||||
m_selectedItems.reserve(info.args.size());
|
||||
for (const hecl::SystemString& arg : info.args) {
|
||||
for (const std::string& arg : info.args) {
|
||||
if (arg.empty())
|
||||
continue;
|
||||
else if (arg == _SYS_STR("--fast")) {
|
||||
else if (arg == "--fast") {
|
||||
m_fast = true;
|
||||
continue;
|
||||
} else if (arg.size() >= 8 && !arg.compare(0, 7, _SYS_STR("--spec="))) {
|
||||
hecl::SystemString specName(arg.begin() + 7, arg.end());
|
||||
} else if (arg.size() >= 8 && !arg.compare(0, 7, "--spec=")) {
|
||||
std::string specName(arg.begin() + 7, arg.end());
|
||||
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY) {
|
||||
if (!hecl::StrCaseCmp(spec->m_name.data(), specName.c_str())) {
|
||||
m_spec = spec;
|
||||
@@ -77,12 +77,12 @@ public:
|
||||
}
|
||||
}
|
||||
if (!m_spec)
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to find data spec '{}'")), specName);
|
||||
LogModule.report(logvisor::Fatal, FMT_STRING("unable to find data spec '{}'"), specName);
|
||||
continue;
|
||||
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
||||
} else if (arg.size() >= 2 && arg[0] == '-' && arg[1] == '-')
|
||||
continue;
|
||||
|
||||
hecl::SystemString subPath;
|
||||
std::string subPath;
|
||||
hecl::ProjectRootPath root = hecl::SearchForProject(MakePathArgAbsolute(arg, info.cwd), subPath);
|
||||
|
||||
if (root) {
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
m_useProj = m_fallbackProj.get();
|
||||
} else if (m_fallbackProj->getProjectRootPath() != root)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
FMT_STRING(_SYS_STR("hecl package can only process multiple items in the same project; ")
|
||||
_SYS_STR("'{}' and '{}' are different projects")),
|
||||
FMT_STRING("hecl package can only process multiple items in the same project; "
|
||||
"'{}' and '{}' are different projects"),
|
||||
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
||||
root.getAbsolutePath());
|
||||
|
||||
@@ -107,60 +107,65 @@ public:
|
||||
|
||||
/* Default case: recursive at root */
|
||||
if (m_selectedItems.empty())
|
||||
FindSelectedItems({*m_useProj, _SYS_STR("")}, true);
|
||||
FindSelectedItems({*m_useProj, ""}, true);
|
||||
}
|
||||
|
||||
static void Help(HelpOutput& help) {
|
||||
help.secHead(_SYS_STR("NAME"));
|
||||
help.secHead("NAME");
|
||||
help.beginWrap();
|
||||
help.wrap(_SYS_STR("hecl-pack\n") _SYS_STR("hecl-package - Package objects within the project database\n"));
|
||||
help.wrap(
|
||||
"hecl-pack\n"
|
||||
"hecl-package - Package objects within the project database\n");
|
||||
help.endWrap();
|
||||
|
||||
help.secHead(_SYS_STR("SYNOPSIS"));
|
||||
help.secHead("SYNOPSIS");
|
||||
help.beginWrap();
|
||||
help.wrap(_SYS_STR("hecl package [--spec=<spec>] [<input-dir>]\n"));
|
||||
help.wrap("hecl package [--spec=<spec>] [<input-dir>]\n");
|
||||
help.endWrap();
|
||||
|
||||
help.secHead(_SYS_STR("DESCRIPTION"));
|
||||
help.secHead("DESCRIPTION");
|
||||
help.beginWrap();
|
||||
help.wrap(_SYS_STR("This command initiates a packaging pass on the project database. Packaging ")
|
||||
_SYS_STR("is analogous to linking in software development. All objects necessary to ") _SYS_STR(
|
||||
"generate a complete package are gathered, grouped, and indexed within a .upak file.\n"));
|
||||
help.wrap(
|
||||
"This command initiates a packaging pass on the project database. Packaging "
|
||||
"is analogous to linking in software development. All objects necessary to "
|
||||
"generate a complete package are gathered, grouped, and indexed within a .upak file.\n");
|
||||
help.endWrap();
|
||||
|
||||
help.secHead(_SYS_STR("OPTIONS"));
|
||||
help.optionHead(_SYS_STR("--spec=<spec>"), _SYS_STR("data specification"));
|
||||
help.secHead("OPTIONS");
|
||||
help.optionHead("--spec=<spec>", "data specification");
|
||||
help.beginWrap();
|
||||
help.wrap(_SYS_STR("Specifies a DataSpec to use when cooking and generating the package. ")
|
||||
_SYS_STR("This build of hecl supports the following values of <spec>:\n"));
|
||||
help.wrap(
|
||||
"Specifies a DataSpec to use when cooking and generating the package. "
|
||||
"This build of hecl supports the following values of <spec>:\n");
|
||||
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY) {
|
||||
if (!spec->m_factory)
|
||||
continue;
|
||||
help.wrap(_SYS_STR(" "));
|
||||
help.wrap(" ");
|
||||
help.wrapBold(spec->m_name.data());
|
||||
help.wrap(_SYS_STR("\n"));
|
||||
help.wrap("\n");
|
||||
}
|
||||
help.endWrap();
|
||||
|
||||
help.secHead(_SYS_STR("OPTIONS"));
|
||||
help.optionHead(_SYS_STR("<input-dir>"), _SYS_STR("input directory"));
|
||||
help.secHead("OPTIONS");
|
||||
help.optionHead("<input-dir>", "input directory");
|
||||
help.beginWrap();
|
||||
help.wrap(_SYS_STR("Specifies a project subdirectory to root the resulting package from. ")
|
||||
_SYS_STR("If any dependent files fall outside this subdirectory, they will be implicitly ")
|
||||
_SYS_STR("gathered and packaged.\n"));
|
||||
help.wrap(
|
||||
"Specifies a project subdirectory to root the resulting package from. "
|
||||
"If any dependent files fall outside this subdirectory, they will be implicitly "
|
||||
"gathered and packaged.\n");
|
||||
help.endWrap();
|
||||
}
|
||||
|
||||
hecl::SystemStringView toolName() const override { return _SYS_STR("package"sv); }
|
||||
std::string_view toolName() const override { return "package"sv; }
|
||||
|
||||
int run() override {
|
||||
if (XTERM_COLOR)
|
||||
fmt::print(FMT_STRING(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n")));
|
||||
fmt::print(FMT_STRING("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n"));
|
||||
else
|
||||
fmt::print(FMT_STRING(_SYS_STR("ABOUT TO PACKAGE:\n")));
|
||||
fmt::print(FMT_STRING("ABOUT TO PACKAGE:\n"));
|
||||
|
||||
for (auto& item : m_selectedItems)
|
||||
fmt::print(FMT_STRING(_SYS_STR(" {}\n")), item.getRelativePath());
|
||||
fmt::print(FMT_STRING(" {}\n"), item.getRelativePath());
|
||||
fflush(stdout);
|
||||
|
||||
if (continuePrompt()) {
|
||||
@@ -168,7 +173,7 @@ public:
|
||||
hecl::ClientProcess cp(&printer);
|
||||
for (const hecl::ProjectPath& path : m_selectedItems) {
|
||||
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
|
||||
LogModule.report(logvisor::Error, FMT_STRING(_SYS_STR("Unable to package {}")), path.getAbsolutePath());
|
||||
LogModule.report(logvisor::Error, FMT_STRING("Unable to package {}"), path.getAbsolutePath());
|
||||
}
|
||||
cp.waitUntilComplete();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user