Skip to content

Commit

Permalink
windows native messaging fixes
Browse files Browse the repository at this point in the history
- write to the correct registry key (it needs to be a subkey rather than a string value)
- fix the executable to be 'granted', rather than 'assumego.exe' (assumego.exe was not working)
  • Loading branch information
chrnorm committed Oct 1, 2024
1 parent f7f5057 commit b6ea0f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/chromemsg/configure_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ func configureWindows() error {
}
defer key.Close()

if err = key.SetStringValue("io.commonfate.granted", manifestPath); err != nil {
gkey, _, err := registry.CreateKey(key, "io.commonfate.granted", registry.QUERY_VALUE|registry.SET_VALUE)
if err != nil {
continue
}
defer gkey.Close()

if err = gkey.SetStringValue("", manifestPath); err != nil {
return err
}
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/chromemsg/write_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"

"github.com/common-fate/granted/internal/build"
)
Expand All @@ -28,6 +29,12 @@ func writeManifest(manifestPath string) error {
return err
}

if runtime.GOOS == "windows" {
// on windows, the file needs to be 'granted.exe' rather than 'assumego.exe'.
parent := filepath.Dir(executablePath)
executablePath = filepath.Join(parent, build.GrantedBinaryName()+".exe")
}

manifest := HostManifest{
Name: "io.commonfate.granted",
Description: "Granted BrowserSupport",
Expand Down

0 comments on commit b6ea0f8

Please sign in to comment.