mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Update the default logs directory and allow collection from elsewhere. (#4352)
* Replace deprecated URL methods. * Start putting log files in Library/Logs (moving existing files with a migration.) * Make Tracing.deleteLogFiles aware of the legacy logs location. * Allow the logs to be collected from a different directory.
This commit is contained in:
@@ -23,10 +23,17 @@ extension URL {
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
static var appGroupLogsDirectory: URL {
|
||||
appGroupContainerDirectory
|
||||
.appending(component: "Library", directoryHint: .isDirectory)
|
||||
.appending(component: "Logs", directoryHint: .isDirectory)
|
||||
.appending(component: InfoPlistReader.main.baseBundleIdentifier, directoryHint: .isDirectory)
|
||||
}
|
||||
|
||||
/// The base directory where all session data is stored.
|
||||
static var sessionsBaseDirectory: URL {
|
||||
let applicationSupportSessionsURL = applicationSupportBaseDirectory.appendingPathComponent("Sessions", isDirectory: true)
|
||||
let applicationSupportSessionsURL = applicationSupportBaseDirectory.appending(component: "Sessions", directoryHint: .isDirectory)
|
||||
|
||||
try? FileManager.default.createDirectoryIfNeeded(at: applicationSupportSessionsURL)
|
||||
|
||||
@@ -36,9 +43,9 @@ extension URL {
|
||||
/// The base directory where all application support data is stored.
|
||||
static var applicationSupportBaseDirectory: URL {
|
||||
var url = appGroupContainerDirectory
|
||||
.appendingPathComponent("Library", isDirectory: true)
|
||||
.appendingPathComponent("Application Support", isDirectory: true)
|
||||
.appendingPathComponent(InfoPlistReader.main.baseBundleIdentifier, isDirectory: true)
|
||||
.appending(component: "Library", directoryHint: .isDirectory)
|
||||
.appending(component: "Application Support", directoryHint: .isDirectory)
|
||||
.appending(component: InfoPlistReader.main.baseBundleIdentifier, directoryHint: .isDirectory)
|
||||
|
||||
try? FileManager.default.createDirectoryIfNeeded(at: url)
|
||||
|
||||
@@ -56,10 +63,10 @@ extension URL {
|
||||
/// The base directory where all application support data is stored.
|
||||
static var sessionCachesBaseDirectory: URL {
|
||||
let url = appGroupContainerDirectory
|
||||
.appendingPathComponent("Library", isDirectory: true)
|
||||
.appendingPathComponent("Caches", isDirectory: true)
|
||||
.appendingPathComponent(InfoPlistReader.main.baseBundleIdentifier, isDirectory: true)
|
||||
.appendingPathComponent("Sessions", isDirectory: true)
|
||||
.appending(component: "Library", directoryHint: .isDirectory)
|
||||
.appending(component: "Caches", directoryHint: .isDirectory)
|
||||
.appending(component: InfoPlistReader.main.baseBundleIdentifier, directoryHint: .isDirectory)
|
||||
.appending(component: "Sessions", directoryHint: .isDirectory)
|
||||
|
||||
try? FileManager.default.createDirectoryIfNeeded(at: url)
|
||||
|
||||
@@ -75,7 +82,7 @@ extension URL {
|
||||
/// Make sure to manually tidy up any files you place in here once you've transferred them from one bundle to another.
|
||||
static var appGroupTemporaryDirectory: URL {
|
||||
let url = appGroupContainerDirectory
|
||||
.appendingPathComponent("tmp", isDirectory: true)
|
||||
.appending(component: "tmp", directoryHint: .isDirectory)
|
||||
|
||||
try? FileManager.default.createDirectoryIfNeeded(at: url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user