Fix launching Windows desktop app (#1511)

On Windows we have erl.exe in two directories: OTP/bin/erl.exe and
OTP/erts-VSN/bin/erl.exe. The executable is identical but what is
different is the latter, the erts one, contains erlexec.dll which needs
to be present for the VM to start.

Interestingly, regardless of OS, the erl[.exe] executable always
prepends the OTP/erts-VSN/bin and OTP/bin directories to the PATH:

    iex> System.get_env("PATH") |> String.split(":") |> Enum.take(2)
    ["/Users/wojtek/.asdf/installs/erlang/25.1.2/erts-13.1.2/bin",
     "/Users/wojtek/.asdf/installs/erlang/25.1.2/bin"]

Manually prepending the erts bin directory to the PATH, which makes the
erl.exe that is to be launched to be the erts one, fixed the issue.
This commit is contained in:
Wojtek Mach 2022-11-02 18:19:53 +01:00 committed by GitHub
parent b911bd71ed
commit 7475e29232
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

19
mix.exs
View file

@ -163,20 +163,25 @@ defmodule Livebook.MixProject do
]
]
],
additional_paths: [
"rel/vendor/otp/bin",
"rel/vendor/elixir/bin",
"/usr/local/bin"
],
macos: [
app_type: :agent,
icon_path: "rel/app/icon-macos.png",
build_dmg: macos_notarization != nil,
notarization: macos_notarization
notarization: macos_notarization,
additional_paths: [
"rel/vendor/otp/bin",
"rel/vendor/elixir/bin",
"/usr/local/bin"
]
],
windows: [
icon_path: "rel/app/icon.ico",
build_installer: true
build_installer: true,
additional_paths: [
"rel/vendor/otp/erts-#{:erlang.system_info(:version)}/bin",
"rel/vendor/otp/bin",
"rel/vendor/elixir/bin"
]
]
]
]