Commit fbbcbcb
fix(paths): legacy ./data check requires node.db, not just dir existence
The "binary exits after setup" / "asks me to set up FFmpeg again" bug
the user has been hitting since at least v0.1.31 traces back to a
single-line footgun in `paths::data_dir()`:
let legacy = PathBuf::from("./data");
if legacy.exists() {
return legacy;
}
The intent was to honour cargo-build dev workflows where the binary
is launched from a repo root that has ./data with the developer's
config — keeping the next launch from silently moving to ProgramData
and orphaning their data.
The bug: this picks up ANY directory named "data" in the launch cwd.
For MSI users testing from a `cmd /c <script>.bat` on their Desktop
where they happen to have a "data" folder (from some other project,
or auto-created during an earlier confused invocation), data_dir
resolves to:
C:\Users\<x>\Desktop\data
instead of the actual install:
C:\ProgramData\SourceBoxSentry
Cascade:
- Config::load reads Desktop\data\node.db → doesn't exist →
needs_setup=true, wizard re-runs every launch.
- find_tool looks for ffmpeg at Desktop\data\ffmpeg\bin\ffmpeg.exe
→ doesn't exist → falls through to bare "ffmpeg" → PATH search
fails → "Io error: program not found", binary exits.
- Meanwhile the REAL data is at C:\ProgramData\SourceBoxSentry
with node.db (40 KB) + ffmpeg/ (200 MB of ffmpeg.exe + ffprobe.exe)
all present; the binary just ignores it.
Diagnosed via the user's PowerShell test today which confirmed
`Test-Path "C:\ProgramData\SourceBoxSentry\ffmpeg\bin\ffmpeg.exe"`
returns True — the file is exactly where we expect, the binary
just isn't looking there.
Fix: require `./data/node.db` to exist, not just `./data/`. Anchors
the legacy check to actual CloudNode state instead of any
coincidentally-named directory in the cwd.
- Cargo-build dev with valid `./data/node.db`: legacy check
succeeds → returns `./data` → existing dev workflow unchanged.
- Cargo-build dev with empty `./data` (rare; only happens if you
manually rm the contents): legacy check fails → falls through to
platform default → user gets fresh setup, no data lost (there
wasn't any).
- MSI install with random `Desktop\data`, `Desktop\data` containing
unrelated files, etc.: legacy check fails → falls through to
`C:\ProgramData\SourceBoxSentry` → finds the install.
- MSI install with cwd = `C:\Program Files\SourceBox Sentry CloudNode\`
(no `data` subdir): legacy check fails → ProgramData → works.
This is the actual long-term fix the user has been asking for: MSI
install + clicking the Start menu shortcut → camera dashboard with
streaming. No PowerShell, no terminal commands, no setup re-prompts.
Bumps version to 0.1.34.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7bcdc19 commit fbbcbcb
3 files changed
Lines changed: 32 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
63 | 90 | | |
64 | | - | |
| 91 | + | |
65 | 92 | | |
66 | 93 | | |
67 | 94 | | |
| |||
0 commit comments