浏览代码

small unicode fixes

Juan Linietsky 10 年之前
父节点
当前提交
7f5b744b92
共有 2 个文件被更改,包括 8 次插入7 次删除
  1. 2 2
      drivers/windows/dir_access_windows.cpp
  2. 6 5
      platform/windows/os_windows.cpp

+ 2 - 2
drivers/windows/dir_access_windows.cpp

@@ -197,7 +197,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
 		if (worked) {
 
 			GetCurrentDirectoryW(2048,real_current_dir_name);
-			current_dir=real_current_dir_name; // TODO, utf8 parser
+			current_dir=real_current_dir_name;
 			current_dir=current_dir.replace("\\","/");
 
 		} //else {
@@ -218,7 +218,7 @@ Error DirAccessWindows::change_dir(String p_dir) {
 		if (worked) {
 
 			GetCurrentDirectoryA(2048,real_current_dir_name);
-			current_dir=real_current_dir_name; // TODO, utf8 parser
+			current_dir=real_current_dir_name;
 			current_dir=current_dir.replace("\\","/");
 
 		}// else {

+ 6 - 5
platform/windows/os_windows.cpp

@@ -2110,12 +2110,13 @@ bool OS_Windows::has_environment(const String& p_var) const {
 
 String OS_Windows::get_environment(const String& p_var) const {
 
-	char* val = getenv(p_var.utf8().get_data());
-	if (val)
-		return val;
-
+	wchar_t wval[0x7Fff]; // MSDN says 32767 char is the maximum
+	int wlen = GetEnvironmentVariableW(p_var.c_str(),wval,0x7Fff);
+	if ( wlen > 0 ) {
+		return wval;
+	}
 	return "";
-};
+}
 
 String OS_Windows::get_stdin_string(bool p_block) {