Expand description
Startup cache repair: keep the app’s cache directory usable before a plugin needs it.
Donor: ViewRight startup_cache.rs. A dangling symlink or a stray file where a cache directory
belongs makes create_dir_all fail with AlreadyExists, which aborts plugins that expect the
directory (tauri-plugin-http cookie cache). Cache content is disposable, so the bad entry is
replaced with a real directory.
ensure_http_cache_dir resolves the platform user cache root (~/Library/Caches,
%LOCALAPPDATA%, or $XDG_CACHE_HOME / ~/.cache) and repairs <root>/<identifier>. It needs
no Tauri handle, so it can run before the Tauri builder starts.
Enums§
- Cache
DirOutcome - What a cache-directory repair did.
Functions§
- ensure_
cache_ dir - Make
patha usable directory, replacing a dangling symlink or a regular file. - ensure_
http_ cache_ dir - Repair
<user cache root>/<identifier>so a plugin can create its cookie or HTTP cache there.identifieris one path component (usually the bundle identifier): empty values, separators,.and..are refused. The root isuser_cache_root; an app whose Tauri resolves the cache directory differently (for example throughdirs::cache_dir()or the Tauri path resolver) usesensure_http_cache_dir_with. - ensure_
http_ cache_ dir_ with ensure_http_cache_dirwith a caller-supplied cache root, so the repaired directory is exactly the one the app’s Tauri resolves:- user_
cache_ root - The platform user cache root that Tauri and
dirsagree on.