From c3909ca03451ccdd3061540691dcb9a16cb57ce5 Mon Sep 17 00:00:00 2001 From: Brandon Sneed Date: Mon, 11 Mar 2024 10:32:16 -0700 Subject: [PATCH] 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. --- Sources/Segment/Utilities/Utils.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Segment/Utilities/Utils.swift b/Sources/Segment/Utilities/Utils.swift index aa6a81e9..b06d2695 100644 --- a/Sources/Segment/Utilities/Utils.swift +++ b/Sources/Segment/Utilities/Utils.swift @@ -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)