diff --git a/src/slic3r/GUI/SendSystemInfoDialog.cpp b/src/slic3r/GUI/SendSystemInfoDialog.cpp index bdf6743fc..34178133f 100644 --- a/src/slic3r/GUI/SendSystemInfoDialog.cpp +++ b/src/slic3r/GUI/SendSystemInfoDialog.cpp @@ -35,6 +35,8 @@ #include #include #pragma comment(lib, "iphlpapi.lib") +#elif __APPLE__ +#import #endif namespace Slic3r { @@ -265,7 +267,19 @@ static std::string get_unique_id() } free(AdapterInfo); #elif __APPLE__ + constexpr int buf_size = 100; + char buf[buf_size] = ""; + memset(&buf, 0, sizeof(buf)); + io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); + CFStringRef uuidCf = (CFStringRef)IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + IOObjectRelease(ioRegistryRoot); + CFStringGetCString(uuidCf, buf, buf_size, kCFStringEncodingMacRoman); + CFRelease(uuidCf); + // Now convert the string to std::vector. + for (char* c = buf; *c != 0; ++c) + unique.emplace_back((unsigned char)(*c)); #else // Linux/BSD + #endif // We should have a unique vector. Append a long prime to be