Overview
Comment: | Add +[OFSystemInfo operatingSystem{Name,Version}] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c6ed29d88120aafa7344a8f0e3739b1d |
User & Date: | js on 2018-03-17 21:53:41 |
Other Links: | manifest | tags |
Context
2018-03-18
| ||
00:28 | Add support for parsing XML property lists check-in: db0bf9d5a7 user: js tags: trunk | |
2018-03-17
| ||
21:53 | Add +[OFSystemInfo operatingSystem{Name,Version}] check-in: c6ed29d881 user: js tags: trunk | |
2018-03-13
| ||
23:05 | Treat the leading slash of a path as a component check-in: a7ce7bb441 user: js tags: trunk | |
Changes
Modified configure.ac from [026ea97419] to [7eb6a2f680].
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | ]) AC_CHECK_HEADERS(fcntl.h dirent.h) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl]) AC_CHECK_HEADERS(xlocale.h) AC_CHECK_FUNCS([strtod_l strtof_l asprintf_l]) AC_CHECK_FUNC(pipe, [ AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()]) ]) AC_ARG_ENABLE(sockets, AS_HELP_STRING([--disable-sockets], [disable socket support])) | > > > | 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | ]) AC_CHECK_HEADERS(fcntl.h dirent.h) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl]) AC_CHECK_HEADERS(xlocale.h) AC_CHECK_FUNCS([strtod_l strtof_l asprintf_l]) AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_FUNCS(uname) AC_CHECK_FUNC(pipe, [ AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()]) ]) AC_ARG_ENABLE(sockets, AS_HELP_STRING([--disable-sockets], [disable socket support])) |
︙ | ︙ |
Modified src/OFSystemInfo.h from [3ad9329aa1] to [6c02f851ee].
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * * @brief A class for querying information about the system. */ @interface OFSystemInfo: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) size_t pageSize; @property (class, readonly, nonatomic) size_t numberOfCPUs; # ifdef OF_HAVE_FILES @property (class, readonly, nullable, nonatomic) OFString *userDataPath; @property (class, readonly, nullable, nonatomic) OFString *userConfigPath; # endif @property (class, readonly, nullable, nonatomic) OFString *CPUVendor; # if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsMMX; | > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * * @brief A class for querying information about the system. */ @interface OFSystemInfo: OFObject #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) size_t pageSize; @property (class, readonly, nonatomic) size_t numberOfCPUs; @property (class, readonly, nullable, nonatomic) OFString *operatingSystemName; @property (class, readonly, nullable, nonatomic) OFString *operatingSystemVersion; # ifdef OF_HAVE_FILES @property (class, readonly, nullable, nonatomic) OFString *userDataPath; @property (class, readonly, nullable, nonatomic) OFString *userConfigPath; # endif @property (class, readonly, nullable, nonatomic) OFString *CPUVendor; # if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsMMX; |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | * * A CPU with multiple cores counts as multiple CPUs. * * @return The number of CPUs installed in the system */ + (size_t)numberOfCPUs; #ifdef OF_HAVE_FILES /*! * @brief Returns the path where user data for the application can be stored. * * On Unix systems, this adheres to the XDG Base Directory specification.@n * On Mac OS X and iOS, it uses the `NSApplicationSupportDirectory` directory.@n * On Windows, it uses the `APPDATA` environment variable.@n | > > > > > > > > > > > > > > > > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | * * A CPU with multiple cores counts as multiple CPUs. * * @return The number of CPUs installed in the system */ + (size_t)numberOfCPUs; /** * @brief Returns the name of the operating system the application is running * on. * * @return The name of the operating system the application is running on */ + (nullable OFString *)operatingSystemName; /** * @brief Returns the version of the operating system the application is * running on. * * @return The version of the operating system the application is running on */ + (nullable OFString *)operatingSystemVersion; #ifdef OF_HAVE_FILES /*! * @brief Returns the path where user data for the application can be stored. * * On Unix systems, this adheres to the XDG Base Directory specification.@n * On Mac OS X and iOS, it uses the `NSApplicationSupportDirectory` directory.@n * On Windows, it uses the `APPDATA` environment variable.@n |
︙ | ︙ |
Modified src/OFSystemInfo.m from [46e156926e] to [b1d4d96275].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <limits.h> /* include any libc header to get the libc defines */ #include "unistd_wrapper.h" #include "platform.h" #ifdef OF_MACOS # include <sys/sysctl.h> #endif #ifdef OF_MORPHOS # define BOOL EXEC_BOOL # include <exec/system.h> # include <proto/exec.h> # undef BOOL #endif #import "OFSystemInfo.h" | > > > | > | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include <limits.h> /* include any libc header to get the libc defines */ #include "unistd_wrapper.h" #include "platform.h" #ifdef HAVE_SYS_UTSNAME_H # include <sys/utsname.h> #endif #ifdef OF_MACOS # include <sys/sysctl.h> #endif #ifdef OF_MORPHOS # define BOOL EXEC_BOOL # include <exec/system.h> # include <proto/exec.h> # undef BOOL #endif #import "OFSystemInfo.h" #import "OFApplication.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFLocalization.h" #import "OFString.h" #import "OFNotImplementedException.h" #if defined(OF_MACOS) || defined(OF_IOS) # ifdef HAVE_SYSDIR_H # include <sysdir.h> # endif |
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 | return pageSize; } + (size_t)numberOfCPUs { return numberOfCPUs; } #ifdef OF_HAVE_FILES + (OFString *)userDataPath { # if defined(OF_MACOS) || defined(OF_IOS) char pathC[PATH_MAX]; OFMutableString *path; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | return pageSize; } + (size_t)numberOfCPUs { return numberOfCPUs; } + (OFString *)operatingSystemName { #if defined(OF_IOS) return @"iOS"; #elif defined(OF_MACOS) return @"macOS"; #elif defined(OF_WINDOWS) return @"Windows"; #elif defined(OF_ANDROID) return @"Android"; #elif defined(OF_MORPHOS) return @"MorphOS"; #elif defined(OF_AMIGAOS4) return @"AmigaOS 4"; #elif defined(OF_WII) return @"Nintendo Wii"; #elif defined(NINTENDO_3DS) return @"Nintendo 3DS"; #elif defined(OF_NINTENDO_DS) return @"Nintendo DS"; #elif defined(OF_PSP) return @"PlayStation Portable"; #elif defined(OF_MSDOS) return @"MS-DOS"; #elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) struct utsname u; if (uname(&u) != 0) return nil; return [OFString stringWithCString: u.sysname encoding: [OFLocalization encoding]]; #else return nil; #endif } + (OFString *)operatingSystemVersion { #if defined(OF_IOS) || defined(OF_MACOS) /* TODO */ return nil; #elif defined(OF_WINDOWS) /* TODO */ return nil; #elif defined(OF_ANDROID) /* TODO */ return nil; #elif defined(OF_MORPHOS) /* TODO */ return nil; #elif defined(OF_AMIGAOS4) /* TODO */ return nil; #elif defined(OF_WII) || defined(NINTENDO_3DS) || defined(OF_NINTENDO_DS) || \\ defined(OF_PSP) || defined(OF_MSDOS) return nil; #elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) struct utsname u; if (uname(&u) != 0) return nil; return [OFString stringWithCString: u.release encoding: [OFLocalization encoding]]; #else return nil; #endif } #ifdef OF_HAVE_FILES + (OFString *)userDataPath { # if defined(OF_MACOS) || defined(OF_IOS) char pathC[PATH_MAX]; OFMutableString *path; |
︙ | ︙ |