Skip to content

Fix pairing file lookup on Windows to use %APPDATA% - #237

Merged
bitxeno merged 1 commit into
masterfrom
fix/windows-pairing-files-dir
Oct 27, 2026
Merged

bitxeno merged 1 commit into
masterfrom
fix/windows-pairing-files-dir

Conversation

@bitxeno

@bitxeno bitxeno commented Oct 27, 2026

Copy link
Copy Markdown
Owner

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.

plumesign resolves its data directory via get_data_path:

  • Windows: %APPDATA%\PlumeImpactor
  • elsewhere: $XDG_CONFIG_HOME/PlumeImpactor, falling back to ~/.config/PlumeImpactor

atvloadly hard-coded ~/.config/PlumeImpactor, so on Windows it read a directory plumesign never writes to.

Approach

CheckDevicePairedContext short-circuits when the pairing-file directory holds no *.plist:

if !utils.ExistFiles(app.RemotePairingDir(), "*.plist") {
    return nil, nil
}

Because that directory was empty on Windows, every mDNS pairing check returned early and silently, so SaveDevice never ran — the device was paired but never added. Manual (pairing-file) devices failed the same way through loadManualDevicesFromDir.

The fix is to resolve SideloadDataDir exactly as plumesign does rather than introducing a Windows-specific special case. RemotePairingDir and the accounts.json path 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

  • SideloadDataDir now branches on runtime.GOOS: %APPDATA% on Windows, $XDG_CONFIG_HOME (then ~/.config) elsewhere, each joined with PlumeImpactor. It mirrors plumesign's get_data_path line for line.
  • Added debug logging in CheckDevicePairedContext for the empty-directory case (prints the directory actually searched) and for find-pairing failures (prints stderr), so a future path mismatch is diagnosable instead of silent.
  • Tests: config_test.go pins the Windows and non-Windows resolution plus the unset-variable fallback; manual_device_test.go now 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, and golangci-lint (0 issues); internal/app and internal/manager tests pass.

Links

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
@bitxeno
bitxeno merged commit 76eb7b3 into master Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址