Fix: auto-detect Things DB container dir instead of hardcoding suffix#1
Merged
Merged
Conversation
The ThingsData-XXXXX directory suffix under the group container is randomized per Things install, so the hardcoded ThingsData-C1ON7 path fails on every other machine with 'Cannot open database because the directory does not exist'. Resolve the DB path at runtime: honor a THINGS_DB_PATH override, else scan the group container for the live ThingsData-* dir, else fall back to the legacy hardcoded path so error messages stay informative.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
src/lib/constants.jshardcoded the Things database path with the container suffixThingsData-C1ON7. That suffix is randomized per Things install, so the path resolves only on the machine the repo was developed on. On every other machine, all reads fail with:(Confirmed on a fresh machine where the live dir is
ThingsData-L7FPA.)Fix
Resolve the DB path at runtime:
THINGS_DB_PATHenv var, if set (explicit override)ThingsData-*dir containingThings Database.thingsdatabase/main.sqlite(skipsBackups/)Testing
npm test— all 71 tests pass (13 suites, unit + integration). Change is additive; the env-override path keeps the existing fixture-based integration tests working.