INNER CODE UNIT · Swift
getDefaultStoragePath
ZachNagengast/similarity-search-kit · Sources/SimilaritySearchKit/Core/Index/SimilarityIndex.swift:366
private func getDefaultStoragePath() throws -> URL {
let appName = Bundle.main.bundleIdentifier ?? "SimilaritySearchKit"
let fileManager = FileManager.default
let appSupportDirectory = try fileManager.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
let appSpecificDirectory = appSupportDirectory.appendingPathComponent(appName)
if !fileManager.fileExists(atPath: appSpecificDirectory.path) {
try fileManager.createDirectory(at: appSpecificDirectory, withIntermediateDirectories: true, attributes: nil)
}
return appSpecificDirectory
}
func estimatedSizeInBytes() -> Int {
var totalSize = 0
for item in indexItems {