Jun
Jun

Reputation: 347

Specifying Native Messaging Host for Chrome extension

I am using native messaging API in Chrome extension, and I want to ship the native application within my extension.

In Windows, I add a registry key under HKLM\SOFTWARE\Google\Chrome\NativeMessagingHosts. Since my application is inside the extension folder after installed, I reference the full path by "%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions\...\....json". But in this way, my extension complains "Specified native messaging host not found.".

If I expand the %LOCALAPPDATA% and write the path as "C:\Users\...\AppData\Local\Google\Chrome\User Data\Default\Extensions\...\....json", then my extension can successfully communicate with the host.

I wonder if this is an intended behavior? Thank you for your help.

Upvotes: 1

Views: 2556

Answers (1)

sowbug
sowbug

Reputation: 4672

There is no expansion of environment variables in the current Chromium code. It sounds like a reasonable feature request, though there might be security reasons not to do it. If you file a bug, we'll have a look and see whether it's feasible.

Upvotes: 1

Related Questions