Skip to content

Commit

Permalink
Updated storage directory selection logic (#307)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bsneed authored Mar 11, 2024
1 parent da06eb0 commit c3909ca
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Segment/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ extension Optional: Flattenable {
}

internal func eventStorageDirectory(writeKey: String) -> URL {
#if os(tvOS) || os(macOS)
let searchPathDirectory = FileManager.SearchPathDirectory.cachesDirectory
#else
#if (os(iOS) || os(watchOS)) && !targetEnvironment(macCatalyst)
let searchPathDirectory = FileManager.SearchPathDirectory.documentDirectory
#else
let searchPathDirectory = FileManager.SearchPathDirectory.cachesDirectory
#endif

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

0 comments on commit c3909ca

Please sign in to comment.