summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@nil.im>2020-05-17 12:32:12 +0200
committerJonathan Schleifer <js@nil.im>2020-05-17 12:32:12 +0200
commit898fa8189f2fd510187c67922c5a3b17051a2207 (patch)
treef18975bb5adf692717a6c60bd5eb3e000bd8c6a7
parent12c6216d78a5a679c59d0cd60925e461790dc8e6 (diff)
Add +[OFSystemInfo isWindowsNT]
-rw-r--r--src/OFSystemInfo.h14
-rw-r--r--src/OFSystemInfo.m7
2 files changed, 21 insertions, 0 deletions
diff --git a/src/OFSystemInfo.h b/src/OFSystemInfo.h
index 919a714a..67408073 100644
--- a/src/OFSystemInfo.h
+++ b/src/OFSystemInfo.h
@@ -58,6 +58,9 @@ OF_SUBCLASSING_RESTRICTED
# if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
@property (class, readonly, nonatomic) bool supportsAltiVec;
# endif
+# ifdef OF_WINDOWS
+@property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
+# endif
#endif
/*!
@@ -287,6 +290,17 @@ OF_SUBCLASSING_RESTRICTED
+ (bool)supportsAltiVec;
#endif
+#ifdef OF_WINDOWS
+/*!
+ * @brief Returns whether the application is running on Windows NT.
+ *
+ * @note This method is only available on Windows.
+ *
+ * @return Whether the application is running on Windows NT
+ */
++ (bool)isWindowsNT;
+#endif
+
+ (instancetype)alloc OF_UNAVAILABLE;
- (instancetype)init OF_UNAVAILABLE;
@end
diff --git a/src/OFSystemInfo.m b/src/OFSystemInfo.m
index d81ad790..9b13bb2b 100644
--- a/src/OFSystemInfo.m
+++ b/src/OFSystemInfo.m
@@ -665,6 +665,13 @@ x86_cpuid(uint32_t eax, uint32_t ecx)
}
#endif
+#ifdef OF_WINDOWS
++ (bool)isWindowsNT
+{
+ return !(GetVersion() & 0x80000000);
+}
+#endif
+
- (instancetype)init
{
OF_INVALID_INIT_METHOD