Overview
Comment: | Implement +[operatingSystemVersion] for Windows |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4707e80cdbcffa14355a9f4f802ab418 |
User & Date: | js on 2018-03-18 03:01:43 |
Other Links: | manifest | tags |
Context
2018-03-18
| ||
06:05 | Fix missing #ifdef OF_HAVE_FILES check-in: f059c39b00 user: js tags: trunk | |
03:01 | Implement +[operatingSystemVersion] for Windows check-in: 4707e80cdb user: js tags: trunk | |
01:05 | Fix missing import and typo check-in: c32b3419c2 user: js tags: trunk | |
Changes
Modified configure.ac from [7eb6a2f680] to [b503c44591].
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | *-msdosdjgpp*) enable_shared="no" enable_threads="no" enable_sockets="no" ;; *-*-mingw*) LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition" AC_SUBST(ALLOW_MULTIPLE_DEFINITION, [-Wl,--allow-multiple-definition]) ;; *-psp-*) AS_IF([test x"$DEVKITPSP" = x""], [ AC_MSG_ERROR( [DEVKITPSP is not set! Please set DEVKITPSP.]) | > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | *-msdosdjgpp*) enable_shared="no" enable_threads="no" enable_sockets="no" ;; *-*-mingw*) LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition" LIBS="$LIBS -lversion" AC_SUBST(ALLOW_MULTIPLE_DEFINITION, [-Wl,--allow-multiple-definition]) ;; *-psp-*) AS_IF([test x"$DEVKITPSP" = x""], [ AC_MSG_ERROR( [DEVKITPSP is not set! Please set DEVKITPSP.]) |
︙ | ︙ |
Modified src/OFSystemInfo.m from [2bd7016700] to [d04cf49a1f].
︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #endif } static void initOperatingSystemVersion(void) { #if defined(OF_IOS) || defined(OF_MACOS) void *pool = objc_autoreleasePoolPush(); @try { OFString *propertyList = [OFString stringWithContentsOfFile: @"/System/Library/CoreServices/SystemVersion.plist"]; operatingSystemVersion = [[[propertyList propertyListValue] objectForKey: @"ProductVersion"] copy]; } @finally { objc_autoreleasePoolPop(pool); } #elif defined(OF_WINDOWS) | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 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 | #endif } static void initOperatingSystemVersion(void) { #if defined(OF_IOS) || defined(OF_MACOS) # ifdef OF_HAVE_FILES void *pool = objc_autoreleasePoolPush(); @try { OFString *propertyList = [OFString stringWithContentsOfFile: @"/System/Library/CoreServices/SystemVersion.plist"]; operatingSystemVersion = [[[propertyList propertyListValue] objectForKey: @"ProductVersion"] copy]; } @finally { objc_autoreleasePoolPop(pool); } # endif #elif defined(OF_WINDOWS) void *pool = objc_autoreleasePoolPush(); @try { wchar_t systemDir[PATH_MAX]; UINT systemDirLen; OFString *systemDirString; const of_char16_t *path; void *buffer; DWORD bufferLen; systemDirLen = GetSystemDirectoryW(systemDir, PATH_MAX); if (systemDirLen == 0) return; systemDirString = [OFString stringWithUTF16String: systemDir length: systemDirLen]; path = [[systemDirString stringByAppendingPathComponent: @"kernel32.dll"] UTF16String]; if ((bufferLen = GetFileVersionInfoSizeW(path, NULL)) == 0) return; if ((buffer = malloc(bufferLen)) == 0) return; @try { void *data; UINT dataLen; VS_FIXEDFILEINFO *info; if (!GetFileVersionInfoW(path, 0, bufferLen, buffer)) return; if (!VerQueryValueW(buffer, L"\\", &data, &dataLen) || dataLen < sizeof(info)) return; info = (VS_FIXEDFILEINFO *)data; operatingSystemVersion = [[OFString alloc] initWithFormat: @"%u.%u.%u", HIWORD(info->dwProductVersionMS), LOWORD(info->dwProductVersionMS), HIWORD(info->dwProductVersionLS)]; } @finally { free(buffer); } } @finally { objc_autoreleasePoolPop(pool); } #elif defined(OF_ANDROID) /* TODO */ #elif defined(OF_MORPHOS) /* TODO */ #elif defined(OF_AMIGAOS4) /* TODO */ #elif defined(OF_WII) || defined(NINTENDO_3DS) || defined(OF_NINTENDO_DS) || \ defined(OF_PSP) || defined(OF_MSDOS) /* Intentionally nothing */ #elif defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME) struct utsname utsname; if (uname(&utsname) != 0) return; operatingSystemVersion = [[OFString alloc] initWithCString: utsname.release encoding: [OFLocalization encoding]]; #endif } |
︙ | ︙ |