mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-12 10:45:51 +00:00
Merge pull request #19 from lioncash/fmt
hecl: Correct fmt formatting specifiers
This commit is contained in:
commit
fa1c437b16
@ -189,7 +189,7 @@ inline void MakeDir(const char* dir) {
|
|||||||
HRESULT err;
|
HRESULT err;
|
||||||
if (!CreateDirectoryA(dir, NULL))
|
if (!CreateDirectoryA(dir, NULL))
|
||||||
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
||||||
LogModule.report(logvisor::Fatal, fmt("MakeDir(%s)"), dir);
|
LogModule.report(logvisor::Fatal, fmt("MakeDir({})"), dir);
|
||||||
#else
|
#else
|
||||||
if (mkdir(dir, 0755))
|
if (mkdir(dir, 0755))
|
||||||
if (errno != EEXIST)
|
if (errno != EEXIST)
|
||||||
@ -202,7 +202,7 @@ inline void MakeDir(const wchar_t* dir) {
|
|||||||
HRESULT err;
|
HRESULT err;
|
||||||
if (!CreateDirectoryW(dir, NULL))
|
if (!CreateDirectoryW(dir, NULL))
|
||||||
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
if ((err = GetLastError()) != ERROR_ALREADY_EXISTS)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("MakeDir(%s)")), dir);
|
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("MakeDir({})")), dir);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -370,11 +370,11 @@ inline bool CheckFreeSpace(const SystemChar* path, size_t reqSz) {
|
|||||||
wchar_t* end;
|
wchar_t* end;
|
||||||
DWORD ret = GetFullPathNameW(path, 1024, buf, &end);
|
DWORD ret = GetFullPathNameW(path, 1024, buf, &end);
|
||||||
if (!ret || ret > 1024)
|
if (!ret || ret > 1024)
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetFullPathNameW %s")), path);
|
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetFullPathNameW {}")), path);
|
||||||
if (end)
|
if (end)
|
||||||
end[0] = L'\0';
|
end[0] = L'\0';
|
||||||
if (!GetDiskFreeSpaceExW(buf, &freeBytes, nullptr, nullptr))
|
if (!GetDiskFreeSpaceExW(buf, &freeBytes, nullptr, nullptr))
|
||||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetDiskFreeSpaceExW %s: %d")), path, GetLastError());
|
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("GetDiskFreeSpaceExW {}: {}")), path, GetLastError());
|
||||||
return reqSz < freeBytes.QuadPart;
|
return reqSz < freeBytes.QuadPart;
|
||||||
#else
|
#else
|
||||||
struct statvfs svfs;
|
struct statvfs svfs;
|
||||||
|
@ -368,8 +368,8 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
|
|||||||
auto tmp = fmt::internal::vformat(format, args);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
|
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
|
||||||
for (const std::string& line : lines) {
|
for (const std::string& line : lines) {
|
||||||
auto v = fmt::format(fmt("[%s] %s"), modName, line.c_str());
|
auto v = fmt::format(fmt("[{}] {}"), modName, line);
|
||||||
m_con->m_log.emplace_back(v, Console::Level(severity));
|
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,16 +378,16 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
|
|||||||
auto tmp = fmt::internal::vformat(format, args);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||||
for (const std::string& line : lines) {
|
for (const std::string& line : lines) {
|
||||||
auto v = fmt::format(fmt("[%s] %s"), modName, line.c_str());
|
auto v = fmt::format(fmt("[{}] {}"), modName, line);
|
||||||
m_con->m_log.emplace_back(v, Console::Level(severity));
|
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
||||||
unsigned linenum, fmt::string_view format, fmt::format_args args) {
|
unsigned linenum, fmt::string_view format, fmt::format_args args) {
|
||||||
auto tmp = fmt::internal::vformat(format, args);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
auto v = fmt::format(fmt("[%s] %s %s:%i"), modName, tmp, file, linenum);
|
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, tmp, file, linenum);
|
||||||
m_con->m_log.emplace_back(v, Console::Level(severity));
|
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
|
||||||
@ -395,8 +395,8 @@ void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level
|
|||||||
auto tmp = fmt::internal::vformat(format, args);
|
auto tmp = fmt::internal::vformat(format, args);
|
||||||
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
|
||||||
for (const std::string& line : lines) {
|
for (const std::string& line : lines) {
|
||||||
auto v = fmt::format(fmt("[%s] %s %s:%i"), modName, line.c_str(), file, linenum);
|
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, line, file, linenum);
|
||||||
m_con->m_log.emplace_back(v, Console::Level(severity));
|
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
|
|||||||
// Display the character read on the screen.
|
// Display the character read on the screen.
|
||||||
auto lk = logvisor::LockLog();
|
auto lk = logvisor::LockLog();
|
||||||
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, NULL)) {
|
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, NULL)) {
|
||||||
// LogModule.report(logvisor::Error, fmt("Error with WriteConsole: %08X"), GetLastError());
|
// LogModule.report(logvisor::Error, fmt("Error with WriteConsole: {:08X}"), GetLastError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user