1

I want to add an exe file in Chromium 88 and use c++ to execute it, but after run command

autoninja -C out\Default mini_installer

it showed error about wrong file path of exe file.

how can i put an exe file and bundle it in Chromium ?

Asesh
  • 3,186
  • 2
  • 21
  • 31
  • if it showed error during the build process, then you must made some changes causing that error. What are the changes you made? – Asesh Nov 30 '20 at 03:06
  • the build process was success, but when i press the button to execute exe file it showed the exe file was not existed. I think i was not bundle into the built browser. – windowswind Nov 30 '20 at 03:46
  • Then you should check if the path of that executable file it tried to launch exists or not. Use `base::FilePath`'s helpers to do so in Chromium style. – Asesh Nov 30 '20 at 03:49
  • Also must that file be bundled in your Chromium fork? You should mention and specify those things too – Asesh Nov 30 '20 at 04:41
  • the exe file should be bundled in the Chromium, but which folder should i put it in ? it seems that the build program will not bundle .exe files .Should I need to edit some config files to make it happen? – windowswind Nov 30 '20 at 06:12
  • I have try to put the exe file in my extension folder, but after the extension was installed, i can not found the exe file in the installed folder. – windowswind Nov 30 '20 at 06:14
  • Just putting that executable in the folder won't work. Also when do you want to execute that file? You will have to modify Chromium to execute that file – Asesh Nov 30 '20 at 07:55
  • My job was to build Chromium fork and add a default extension in it, one of functions of the extension is to execute an exe file. So how can i modify Chromium to finish the job? – windowswind Nov 30 '20 at 08:10
  • I am getting stuck now at which folder to place the exe file in the Chromium fork – windowswind Nov 30 '20 at 08:12
  • You cannot use extension to execute an executable file because of sandboxing. If you want to do that then you will have to use native messaging host. Look up native messaging host – Asesh Nov 30 '20 at 08:42
  • yes you are right, i have used an extension api to execute the file. but now the problem was i can not place the exe file, when i used the api it showed can not found the exe file. – windowswind Nov 30 '20 at 08:49

1 Answers1

0

To bundle a file in Chromium, you will have to modify src/chrome/installer/mini_installer/chrome.release. Here's how it looks like: https://source.chromium.org/chromium/chromium/src/+/master:chrome/installer/mini_installer/chrome.release;l=1?q=chrome.release&sq=&ss=chromium

Just to make sure it's updatable when you update/upgrade your Chromium version on a user's machine, it should be placed inside VersionDir folder. For example in your case

# Chrome version dir entries, sorted alphabetically.
# Place your file here:
chromium_foo_file.exe: %(VersionDir)s\

For example if 88.0.0.0 is the version of your Chromium then after the installation is complete, this chromium_foo_file.exe will reside in 88.0.0.0 directory. Also place that file in your out\Default build folder before compiling mini_installer, so that it will be included automatically when building it

Asesh
  • 3,186
  • 2
  • 21
  • 31
  • Thanks very much! It means that I should manual place the exe file into VersionDir after built the Chromium fork ? Can it be place into VersionDir automatically during building progress? – windowswind Dec 01 '20 at 03:27
  • Not really, just modify that `chrome.release` file as mentioned above. And place that executable file in your build folder before building mini installer then it will be automatically copied to that version folder during the installation process. – Asesh Dec 01 '20 at 03:42