2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 07:07: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:
2021-06-30 14:20:45 -04:00
parent 6e12554026
commit 9ca1a38171
160 changed files with 2029 additions and 2753 deletions

View File

@@ -4,12 +4,12 @@
#include <cstdio>
class ToolInit final : public ToolBase {
const hecl::SystemString* m_dir = nullptr;
const std::string* m_dir = nullptr;
public:
explicit ToolInit(const ToolPassInfo& info) : ToolBase(info) {
hecl::Sstat theStat;
const hecl::SystemString* dir;
const std::string* dir;
if (info.args.size())
dir = &info.args.front();
else
@@ -18,18 +18,18 @@ public:
if (hecl::Stat(dir->c_str(), &theStat)) {
hecl::MakeDir(dir->c_str());
if (hecl::Stat(dir->c_str(), &theStat)) {
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("unable to stat '{}'")), *dir);
LogModule.report(logvisor::Fatal, FMT_STRING("unable to stat '{}'"), *dir);
return;
}
}
if (!S_ISDIR(theStat.st_mode)) {
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("'{}' is not a directory")), *dir);
LogModule.report(logvisor::Fatal, FMT_STRING("'{}' is not a directory"), *dir);
return;
}
hecl::SystemString testPath = *dir + _SYS_STR("/.hecl/beacon");
std::string testPath = *dir + "/.hecl/beacon";
if (!hecl::Stat(testPath.c_str(), &theStat)) {
LogModule.report(logvisor::Fatal, FMT_STRING(_SYS_STR("project already exists at '{}'")), *dir);
LogModule.report(logvisor::Fatal, FMT_STRING("project already exists at '{}'"), *dir);
return;
}
@@ -43,35 +43,35 @@ public:
hecl::Database::Project proj((hecl::ProjectRootPath(*m_dir)));
if (logvisor::ErrorCount > ErrorRef)
return 1;
LogModule.report(logvisor::Info, FMT_STRING(_SYS_STR("initialized project at '{}/.hecl'")), *m_dir);
LogModule.report(logvisor::Info, FMT_STRING("initialized project at '{}/.hecl'"), *m_dir);
return 0;
}
static void Help(HelpOutput& help) {
help.secHead(_SYS_STR("NAME"));
help.secHead("NAME");
help.beginWrap();
help.wrap(_SYS_STR("hecl-init - Initialize a brand-new project database\n"));
help.wrap("hecl-init - Initialize a brand-new project database\n");
help.endWrap();
help.secHead(_SYS_STR("SYNOPSIS"));
help.secHead("SYNOPSIS");
help.beginWrap();
help.wrap(_SYS_STR("hecl init [<dir>]\n"));
help.wrap("hecl init [<dir>]\n");
help.endWrap();
help.secHead(_SYS_STR("DESCRIPTION"));
help.secHead("DESCRIPTION");
help.beginWrap();
help.wrap(_SYS_STR("Creates a "));
help.wrapBold(_SYS_STR(".hecl"));
help.wrap(_SYS_STR(" directory within the selected directory with an initialized database index. ")
_SYS_STR("This constitutes an empty HECL project, ready for making stuff!!\n"));
help.wrap("Creates a ");
help.wrapBold(".hecl");
help.wrap(" directory within the selected directory with an initialized database index. "
"This constitutes an empty HECL project, ready for making stuff!!\n");
help.endWrap();
help.secHead(_SYS_STR("OPTIONS"));
help.optionHead(_SYS_STR("<dir>"), _SYS_STR("group directory path"));
help.secHead("OPTIONS");
help.optionHead("<dir>", "group directory path");
help.beginWrap();
help.wrap(_SYS_STR("Directory to create new project database in. If not specified, current directory is used.\n"));
help.wrap("Directory to create new project database in. If not specified, current directory is used.\n");
help.endWrap();
}
hecl::SystemStringView toolName() const override { return _SYS_STR("init"sv); }
std::string_view toolName() const override { return "init"sv; }
};