1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Minimal `home_dir()` shim. We keep this in-tree to avoid pulling in
//! the `dirs` crate just for one lookup.
//!
//! Lookup order:
//! - Unix: `$HOME` (every login shell sets this).
//! - Windows: `%USERPROFILE%` first, falling back to `%HOME%` (some
//! MSYS / Git Bash setups export `HOME` instead of `USERPROFILE`,
//! so honoring both keeps `cargo truce` working in both shells
//! without a `dirs` dependency).
//!
//! Returns `None` only when no usable env var is set; callers that
//! need a hard requirement (e.g. CLAP user-scope install) should
//! propagate the `None` as an error instead of `unwrap()`-ing.
use PathBuf;
/// Hard-required form of [`home_dir`]. Returns a typed error so the
/// surrounding command can print one line ("can't determine home
/// directory: set HOME / USERPROFILE") instead of panicking.
///
/// `install_scope` calls this via `.expect()` for its `_dir`
/// helpers (those signatures predate the Result-form and threading
/// the error through every call site is a bigger refactor than the
/// helper deserves). New callers should prefer `?`-propagation.
///
/// Windows callers go through `require_local_appdata` / `require_appdata`
/// instead; gate accordingly so the function isn't dead-code on Windows.
pub
/// Windows `LOCALAPPDATA` (`%LOCALAPPDATA%`, e.g.
/// `C:\Users\alice\AppData\Local`) — used as the user-scope plug-in
/// install root for CLAP and VST3 on Windows.
pub
/// Windows `APPDATA` (`%APPDATA%`, e.g.
/// `C:\Users\alice\AppData\Roaming`) — used as the user-scope LV2
/// install root on Windows. Distinct from `LOCALAPPDATA`: roaming
/// data follows the user across machines via Active Directory,
/// matching the LV2 convention of bundle-relative resources.
pub