initsubprocess.pas 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // ************************************************************************
  2. // ***************************** CEF4Delphi *******************************
  3. // ************************************************************************
  4. //
  5. // CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
  6. // browser in Delphi applications.
  7. //
  8. // The original license of DCEF3 still applies to CEF4Delphi.
  9. //
  10. // For more information about CEF4Delphi visit :
  11. // https://www.briskbard.com/index.php?lang=en&pageid=cef
  12. //
  13. // Copyright © 2021 Salvador Diaz Fau. All rights reserved.
  14. //
  15. // ************************************************************************
  16. // ************ vvvv Original license and comments below vvvv *************
  17. // ************************************************************************
  18. (*
  19. * Delphi Chromium Embedded 3
  20. *
  21. * Usage allowed under the restrictions of the Lesser GNU General Public License
  22. * or alternatively the restrictions of the Mozilla Public License 1.1
  23. *
  24. * Software distributed under the License is distributed on an "AS IS" basis,
  25. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  26. * the specific language governing rights and limitations under the License.
  27. *
  28. * Unit owner : Henri Gourvest <[email protected]>
  29. * Web site : http://www.progdigy.com
  30. * Repository : http://code.google.com/p/delphichromiumembedded/
  31. * Group : http://groups.google.com/group/delphichromiumembedded
  32. *
  33. * Embarcadero Technologies, Inc is not permitted to use or redistribute
  34. * this source code without explicit permission.
  35. *
  36. *)
  37. unit InitSubProcess;
  38. {$mode ObjFPC}{$H+}
  39. { $I cef.inc}
  40. interface
  41. uses
  42. GlobalCefApplication, uCEFApplication, uCEFWorkScheduler;
  43. implementation
  44. initialization
  45. CreateGlobalCEFApp;
  46. GlobalCEFApp.FrameworkDirPath:='/opt/CEF/current/dist';
  47. GlobalCEFApp.ResourcesDirPath:='/opt/CEF/current/dist';
  48. GlobalCEFApp.LocalesDirPath:='/opt/CEF/current/dist/locales';
  49. if not GlobalCEFApp.StartMainProcess then begin
  50. if GlobalCEFWorkScheduler <> nil then
  51. GlobalCEFWorkScheduler.StopScheduler;
  52. DestroyGlobalCEFApp;
  53. DestroyGlobalCEFWorkScheduler;
  54. halt(0); // exit the subprocess
  55. end;
  56. end.