diff --git a/.gitignore b/.gitignore index cdd800dc..f97cd3af 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /deps !/deps/build.jl .vscode +Manifest.toml diff --git a/Project.toml b/Project.toml index 9c73010d..29d63871 100644 --- a/Project.toml +++ b/Project.toml @@ -3,22 +3,24 @@ uuid = "a1bb12fb-d4d1-54b4-b10a-ee7951ef7ad3" version = "5.0.1-DEV" [deps] +Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" +FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" -URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" +RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" +URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" -FilePaths = "8fc22ac5-c921-52a6-82fd-178b2807b824" - -[extras] -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] +FilePaths = "0.8.1" JSON = "0.19, 0.20, 0.21" -julia = "1.6" +RelocatableFolders = "1" URIs = "1.3" -FilePaths = "0.8.1" +julia = "1.6" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] test = ["Test"] diff --git a/src/Electron.jl b/src/Electron.jl index 262d0e1a..01e704a6 100644 --- a/src/Electron.jl +++ b/src/Electron.jl @@ -1,6 +1,7 @@ module Electron using JSON, URIs, Sockets, Base64, Pkg.Artifacts, FilePaths, UUIDs +using RelocatableFolders export Application, Window, URI, windows, applications, msgchannel, toggle_devtools, load, ElectronAPI @@ -123,6 +124,8 @@ function get_electron_binary_cmd() end end +const MAIN_JS = @path joinpath(@__DIR__, "main.js") + """ function Application() @@ -130,7 +133,9 @@ Start a new Electron application. This will start a new process for that Electron app and return an instance of `Application` that can be used in the construction of Electron windows. """ -function Application(;mainjs=joinpath(@__DIR__, "main.js"), additional_electron_args = String[]) +function Application(; mainjs=normpath(String(MAIN_JS)), additional_electron_args=String[]) + @assert isfile(mainjs) + read(mainjs) # This seems to be required to not hang windows CI?! electron_path = get_electron_binary_cmd() id = replace(string(uuid1()), "-"=>"") @@ -152,7 +157,7 @@ function Application(;mainjs=joinpath(@__DIR__, "main.js"), additional_electron_ secure_cookie_encoded, additional_electron_args... ]) - + new_env = copy(ENV) if haskey(new_env, "ELECTRON_RUN_AS_NODE") delete!(new_env, "ELECTRON_RUN_AS_NODE")