Skip to content

Commit 8289c6c

Browse files
authored
Fixed macOS conditional check. (#2245)
* Fixed macOS conditional check. Turns out TARGET_OS_MAC is 1 for macOS and iOS, we should be using TARGET_OS_OSX instead. Tweet with some history: https://twitter.com/gparker/status/836341915037515778 * Update README.
1 parent 2ad5e1c commit 8289c6c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Firestore/Source/Local/FSTLevelDB.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ + (Path)documentsDirectory {
383383
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
384384
return Path::FromNSString(directories[0]).AppendUtf8(kReservedPathComponent);
385385

386-
#elif TARGET_OS_MAC
386+
#elif TARGET_OS_OSX
387387
std::string dotPrefixed = absl::StrCat(".", kReservedPathComponent);
388388
return Path::FromNSString(NSHomeDirectory()).AppendUtf8(dotPrefixed);
389389

GoogleUtilities/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
2-
- Fix `pod lib lint GoogleUtilities.podspec --use-libraries` regression. (#2130)
2+
- Fixed `pod lib lint GoogleUtilities.podspec --use-libraries` regression. (#2130)
3+
- Fixed macOS conditional check in UserDefaults. (#2245)
34

45
# 5.3.6
56
- Fix nullability issues. (#2079)

GoogleUtilities/Example/Tests/UserDefaults/GULUserDefaultsTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,15 +432,15 @@ - (void)testUserDefaultNotifications {
432432
}
433433

434434
- (void)testSynchronizeToDisk {
435-
#if TARGET_OS_MAC
435+
#if TARGET_OS_OSX
436436
// `NSFileManager` has trouble reading the files in `~/Library` even though the
437437
// `removeItemAtPath:` call works. Watching Finder while stepping through this test shows that the
438438
// file does get created and removed properly. When using LLDB to call `fileExistsAtPath:` the
439439
// correct return value of `YES` is returned, but in this test it returns `NO`. Best guess is the
440440
// test app is sandboxed and `NSFileManager` is refusing to read the directory.
441441
// TODO: Investigate the failure and re-enable this test.
442442
return;
443-
#endif // TARGET_OS_MAC
443+
#endif // TARGET_OS_OSX
444444
NSString *suiteName = [NSString stringWithFormat:@"another_test_suite"];
445445
NSString *filePath = [self filePathForPreferencesName:suiteName];
446446
NSFileManager *fileManager = [NSFileManager defaultManager];

GoogleUtilities/UserDefaults/GULUserDefaults.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ - (void)synchronize {
201201
- (void)clearAllData {
202202
// On macOS, using `kCFPreferencesCurrentHost` will not set all the keys necessary to match
203203
// `NSUserDefaults`.
204-
#if TARGET_OS_MAC
204+
#if TARGET_OS_OSX
205205
CFStringRef host = kCFPreferencesAnyHost;
206206
#else
207207
CFStringRef host = kCFPreferencesCurrentHost;

0 commit comments

Comments
 (0)