Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c3909ca

Browse files
authoredMar 11, 2024
Updated storage directory selection logic (#307)
The logic for selecting the event storage directory has been updated. Previously, it was based on whether the operating system was tvOS or macOS. Now, it's determined by whether the OS is iOS or watchOS and not running in a Mac Catalyst environment. This change should improve data handling across different platforms.
1 parent da06eb0 commit c3909ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎Sources/Segment/Utilities/Utils.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ extension Optional: Flattenable {
7070
}
7171

7272
internal func eventStorageDirectory(writeKey: String) -> URL {
73-
#if os(tvOS) || os(macOS)
74-
let searchPathDirectory = FileManager.SearchPathDirectory.cachesDirectory
75-
#else
73+
#if (os(iOS) || os(watchOS)) && !targetEnvironment(macCatalyst)
7674
let searchPathDirectory = FileManager.SearchPathDirectory.documentDirectory
75+
#else
76+
let searchPathDirectory = FileManager.SearchPathDirectory.cachesDirectory
7777
#endif
7878

7979
let urls = FileManager.default.urls(for: searchPathDirectory, in: .userDomainMask)

0 commit comments

Comments
 (0)
Please sign in to comment.