mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 01:19:38 +01:00
Ported from godot4: Fix reading Unicode from stdio.
- bruvzg
3d8a942a56
This commit is contained in:
parent
c4e76950fa
commit
4bb48a4a5c
@ -138,9 +138,7 @@ void OS_Unix::alert(const String &p_alert, const String &p_title) {
|
||||
|
||||
String OS_Unix::get_stdin_string() {
|
||||
char buff[1024];
|
||||
String ret = stdin_buf + fgets(buff, 1024, stdin);
|
||||
stdin_buf = "";
|
||||
return ret;
|
||||
return String::utf8(fgets(buff, 1024, stdin));
|
||||
}
|
||||
|
||||
String OS_Unix::get_name() const {
|
||||
|
@ -46,8 +46,6 @@ protected:
|
||||
|
||||
virtual void finalize_core();
|
||||
|
||||
String stdin_buf;
|
||||
|
||||
public:
|
||||
OS_Unix();
|
||||
|
||||
|
@ -3166,8 +3166,11 @@ bool OS_Windows::set_environment(const String &p_var, const String &p_value) con
|
||||
}
|
||||
|
||||
String OS_Windows::get_stdin_string() {
|
||||
char buff[1024];
|
||||
return fgets(buff, 1024, stdin);
|
||||
WCHAR buff[1024];
|
||||
DWORD count = 0;
|
||||
if (ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), buff, 1024, &count, nullptr)) {
|
||||
return String::utf16((const char16_t *)buff, count);
|
||||
}
|
||||
}
|
||||
|
||||
void OS_Windows::enable_for_stealing_focus(ProcessID pid) {
|
||||
|
Loading…
Reference in New Issue
Block a user