Repository navigation
Fix pairing file lookup on Windows to use %APPDATA% - #237
Merged
Merged
Conversation
plumesign resolves its data directory through get_data_path: %APPDATA%\ PlumeImpactor on Windows and $XDG_CONFIG_HOME/PlumeImpactor (falling back to ~/.config/PlumeImpactor) elsewhere. atvloadly hard-coded ~/.config/PlumeImpactor, so on Windows it read a directory plumesign never writes to. The pairing file directory is the first thing CheckDevicePairedContext checks: an empty directory returns early, so a successful mDNS pairing produced no "add device" event and the device never appeared in the paired list. Manual (pairing-file) devices failed the same way through loadManualDevicesFromDir. Resolve SideloadDataDir exactly as plumesign does; RemotePairingDir and the accounts file follow it. Log the searched directory and the find-pairing error at debug level so a future path mismatch is diagnosable instead of silent. Fixes #236
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.
Why
On Windows, an Apple TV paired successfully over mDNS but never appeared in the paired-devices list, and no "add device" event was logged (issue #236). The pairing itself succeeded — the pairing file was written — but atvloadly looked for it in the wrong directory.
plumesignresolves its data directory viaget_data_path:%APPDATA%\PlumeImpactor$XDG_CONFIG_HOME/PlumeImpactor, falling back to~/.config/PlumeImpactoratvloadly hard-coded
~/.config/PlumeImpactor, so on Windows it read a directoryplumesignnever writes to.Approach
CheckDevicePairedContextshort-circuits when the pairing-file directory holds no*.plist:Because that directory was empty on Windows, every mDNS pairing check returned early and silently, so
SaveDevicenever ran — the device was paired but never added. Manual (pairing-file) devices failed the same way throughloadManualDevicesFromDir.The fix is to resolve
SideloadDataDirexactly asplumesigndoes rather than introducing a Windows-specific special case.RemotePairingDirand theaccounts.jsonpath both derive from it, so one correction fixes all of them — including the latent bug where the accounts file was read from the wrong directory on Windows.How it works
SideloadDataDirnow branches onruntime.GOOS:%APPDATA%on Windows,$XDG_CONFIG_HOME(then~/.config) elsewhere, each joined withPlumeImpactor. It mirrorsplumesign'sget_data_pathline for line.CheckDevicePairedContextfor the empty-directory case (prints the directory actually searched) and forfind-pairingfailures (prints stderr), so a future path mismatch is diagnosable instead of silent.config_test.gopins the Windows and non-Windows resolution plus the unset-variable fallback;manual_device_test.gonow points the data dir at a temp directory for the current OS instead of assuming$HOME/.config.Verified with
go build ./...,GOOS=windows go build ./...,go vet, andgolangci-lint(0 issues);internal/appandinternal/managertests pass.Links