IosStorageUsageFileSystem

internal class IosStorageUsageFileSystem(val fileManager: NSFileManager = NSFileManager.defaultManager, val homePath: String = NSHomeDirectory())(source)

Measures and mutates app-private iOS storage used by Settings usage screens.

The paths intentionally match the iOS data layer: downloaded local models live under Library/Application Support/model, while transient app files live under Library/Caches.

Author

Dmitriy Moroz

Parameters

fileManager

Native file manager used for path traversal and deletion.

homePath

App sandbox home directory.

Constructors

Link copied to clipboard
constructor(fileManager: NSFileManager = NSFileManager.defaultManager, homePath: String = NSHomeDirectory())

Types

Link copied to clipboard
private object Companion

Smallest iOS storage amount worth showing to users.

Properties

Link copied to clipboard
private val cacheDirPath: String
Link copied to clipboard
private val fileManager: NSFileManager
Link copied to clipboard
private val homePath: String
Link copied to clipboard

Functions

Link copied to clipboard
private fun String.child(name: String): String

Appends a single child component to an app-private path.

Link copied to clipboard

Deletes every local model directory without deleting the model store directory itself.

Link copied to clipboard

Deletes cache directory children without deleting the cache directory itself.

Link copied to clipboard
private fun String.fileSize(): Long

Reads the filesystem-reported size for one path.

Link copied to clipboard

Returns the total size of every local model directory in bytes.

Link copied to clipboard

Returns the current size of the app cache directory in bytes.

Link copied to clipboard

Returns the total size of downloaded local model directories in bytes.

Link copied to clipboard

Hides tiny iOS filesystem bookkeeping sizes from user-facing storage UI.

Link copied to clipboard
private fun String.pathSize(): Long

Recursively measures an existing file or directory path.