mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 00:59:28 +01:00
18 lines
530 B
TypeScript
18 lines
530 B
TypeScript
import RNFS from 'react-native-fs'
|
|
import path from 'path'
|
|
import { CacheItemTypeKey } from '@app/models/cache'
|
|
|
|
const serversCacheDir = path.join(RNFS.ExternalDirectoryPath, 's')
|
|
|
|
function cacheDir(serverId?: string, itemType?: CacheItemTypeKey, itemId?: string): string {
|
|
const segments: string[] = []
|
|
|
|
serverId && segments.push(serverId)
|
|
serverId && itemType && segments.push(itemType)
|
|
serverId && itemType && itemId && segments.push(itemId)
|
|
|
|
return path.join(serversCacheDir, ...segments)
|
|
}
|
|
|
|
export default cacheDir
|