mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 03:27:12 +01:00
[vcpkg] Remove more uses of iostreams. Force 'C' locale -- localization is TODO.
This commit is contained in:
parent
c055def453
commit
4806aaf460
@ -180,9 +180,6 @@ int wmain(const int argc, const wchar_t* const* const argv)
|
||||
if (argc == 0)
|
||||
std::abort();
|
||||
|
||||
std::cout.sync_with_stdio(false);
|
||||
std::cout.imbue(std::locale::classic());
|
||||
|
||||
g_timer.start();
|
||||
atexit([]()
|
||||
{
|
||||
@ -231,17 +228,22 @@ int wmain(const int argc, const wchar_t* const* const argv)
|
||||
exc_msg = "unknown error(...)";
|
||||
}
|
||||
TrackProperty("error", exc_msg);
|
||||
std::cerr
|
||||
<< "vcpkg.exe has crashed.\n"
|
||||
<< "Please send an email to:\n"
|
||||
<< " " << Commands::Contact::email() << "\n"
|
||||
<< "containing a brief summary of what you were trying to do and the following data blob:\n"
|
||||
<< "\n"
|
||||
<< "Version=" << Commands::Version::version() << "\n"
|
||||
<< "EXCEPTION='" << exc_msg << "'\n"
|
||||
<< "CMD=\n";
|
||||
|
||||
fflush(stdout);
|
||||
System::print(
|
||||
"vcpkg.exe has crashed.\n"
|
||||
"Please send an email to:\n"
|
||||
" %s\n"
|
||||
"containing a brief summary of what you were trying to do and the following data blob:\n"
|
||||
"\n"
|
||||
"Version=%s\n"
|
||||
"EXCEPTION='%s'\n"
|
||||
"CMD=\n",
|
||||
Commands::Contact::email(),
|
||||
Commands::Version::version(),
|
||||
exc_msg);
|
||||
fflush(stdout);
|
||||
for (int x = 0; x < argc; ++x)
|
||||
std::cerr << Strings::utf16_to_utf8(argv[x]) << "|\n";
|
||||
std::cerr
|
||||
<< "\n";
|
||||
System::println("%s|", Strings::utf16_to_utf8(argv[x]));
|
||||
fflush(stdout);
|
||||
}
|
||||
|
@ -15,14 +15,20 @@ namespace vcpkg::Strings::details
|
||||
return static_cast<char>(std::tolower(c));
|
||||
}
|
||||
|
||||
static _locale_t& c_locale()
|
||||
{
|
||||
static _locale_t c_locale_impl = _create_locale(LC_ALL, "C");
|
||||
return c_locale_impl;
|
||||
}
|
||||
|
||||
std::string format_internal(const char* fmtstr, ...)
|
||||
{
|
||||
va_list lst;
|
||||
va_start(lst, fmtstr);
|
||||
|
||||
const int sz = _vscprintf(fmtstr, lst);
|
||||
const int sz = _vscprintf_l(fmtstr, c_locale(), lst);
|
||||
std::string output(sz, '\0');
|
||||
_vsnprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst);
|
||||
_vsnprintf_s_l(&output[0], output.size() + 1, output.size() + 1, fmtstr, c_locale(), lst);
|
||||
va_end(lst);
|
||||
|
||||
return output;
|
||||
@ -33,9 +39,9 @@ namespace vcpkg::Strings::details
|
||||
va_list lst;
|
||||
va_start(lst, fmtstr);
|
||||
|
||||
const int sz = _vscwprintf(fmtstr, lst);
|
||||
const int sz = _vscwprintf_l(fmtstr, c_locale(), lst);
|
||||
std::wstring output(sz, '\0');
|
||||
_vsnwprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst);
|
||||
_vsnwprintf_s_l(&output[0], output.size() + 1, output.size() + 1, fmtstr, c_locale(), lst);
|
||||
va_end(lst);
|
||||
|
||||
return output;
|
||||
|
@ -14,8 +14,8 @@ namespace vcpkg::System
|
||||
|
||||
int cmd_execute(const wchar_t* cmd_line)
|
||||
{
|
||||
// Flush cout before launching external process
|
||||
std::cout << std::flush;
|
||||
// Flush stdout before launching external process
|
||||
fflush(stdout);
|
||||
|
||||
// Basically we are wrapping it in quotes
|
||||
const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line);
|
||||
@ -25,8 +25,8 @@ namespace vcpkg::System
|
||||
|
||||
exit_code_and_output cmd_execute_and_capture_output(const wchar_t* cmd_line)
|
||||
{
|
||||
// Flush cout before launching external process
|
||||
std::cout << std::flush;
|
||||
// Flush stdout before launching external process
|
||||
fflush(stdout);
|
||||
|
||||
const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user