aboutsummaryrefslogtreecommitdiff
path: root/drivers/unix/ip_unix.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2016-09-10 11:47:42 -0300
committerGitHub2016-09-10 11:47:42 -0300
commit7a27d5d9e7db4a52b1c9dcac474f6478d3c17efa (patch)
tree3b8abf061381d192728ca10d0a51a30e93dd6d89 /drivers/unix/ip_unix.cpp
parentc2b70fdd6947c397cf0ad3fd9aa1cceacaeb1ba3 (diff)
parent15458c8e6a4945ab27f9aa4ca31fd1eeef0e2cb7 (diff)
downloadgodot-7a27d5d9e7db4a52b1c9dcac474f6478d3c17efa.tar.gz
godot-7a27d5d9e7db4a52b1c9dcac474f6478d3c17efa.tar.zst
godot-7a27d5d9e7db4a52b1c9dcac474f6478d3c17efa.zip
Merge pull request #6363 from vnen/winrt
Fix the support for WinRT/UWP
Diffstat (limited to 'drivers/unix/ip_unix.cpp')
-rw-r--r--drivers/unix/ip_unix.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index 535a42530..08a8c1958 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "ip_unix.h"
-#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED)
+#if defined(UNIX_ENABLED) || defined(WINDOWS_ENABLED)
#ifdef WINDOWS_ENABLED
@@ -83,6 +83,19 @@ IP_Address IP_Unix::_resolve_hostname(const String& p_hostname) {
void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
+ using namespace Windows::Networking;
+ using namespace Windows::Networking::Connectivity;
+
+ auto hostnames = NetworkInformation::GetHostNames();
+
+ for (int i = 0; i < hostnames->Size; i++) {
+
+ if (hostnames->GetAt(i)->Type == HostNameType::Ipv4 && hostnames->GetAt(i)->IPInformation != nullptr) {
+
+ r_addresses->push_back(IP_Address(String(hostnames->GetAt(i)->CanonicalName->Data())));
+
+ }
+ }
};
#else