@@ -21,7 +21,9 @@ ensure_port() ->
2121 % % If it already exists in priv/, validate it as well (production policy).
2222 ok = ensure_http_started (),
2323 case maybe_verify_sha256 (Url , Path ) of
24- ok -> Path ;
24+ ok ->
25+ ok = maybe_chmod (Path ),
26+ Path ;
2527 {error , _ } ->
2628 _ = file :delete (Path ),
2729 ensure_port ()
@@ -31,6 +33,7 @@ ensure_port() ->
3133 % % exist in "./priv". This avoids forcing a download during development.
3234 case local_repo_port () of
3335 {ok , Local } ->
36+ ok = maybe_chmod (Local ),
3437 Local ;
3538 error ->
3639 ok = ensure_http_started (),
@@ -44,7 +47,9 @@ ensure_port() ->
4447 % % If the download fails, try a typical dev fallback:
4548 % % priv/minigui_port or priv/minigui_port.exe (if present)
4649 case fallback_dev_port (PrivDir ) of
47- {ok , Fallback } -> Fallback ;
50+ {ok , Fallback } ->
51+ ok = maybe_chmod (Fallback ),
52+ Fallback ;
4853 error -> erlang :error ({minigui_port_download_failed , Url , Reason })
4954 end
5055 end
@@ -64,23 +69,23 @@ priv_dir() ->
6469fallback_dev_port (PrivDir ) ->
6570 % % Prefer release names (minigui/minigui.exe), but accept the historical
6671 % % minigui_port(/.exe) name for development.
67- Candidates = [
68- filename :join (PrivDir , " minigui" ),
69- filename :join (PrivDir , " minigui.exe" ),
70- filename :join (PrivDir , " minigui_port" ),
71- filename :join (PrivDir , " minigui_port.exe" )
72- ],
72+ Candidates = dev_candidates (PrivDir ),
7373 first_existing (Candidates ).
7474
7575local_repo_port () ->
76- Candidates = [
77- filename :absname (filename :join ([" priv" , " minigui" ])),
78- filename :absname (filename :join ([" priv" , " minigui.exe" ])),
79- filename :absname (filename :join ([" priv" , " minigui_port" ])),
80- filename :absname (filename :join ([" priv" , " minigui_port.exe" ]))
81- ],
76+ Candidates = dev_candidates (" priv" ),
8277 first_existing (Candidates ).
8378
79+ dev_candidates (Dir ) ->
80+ Names =
81+ case os :type () of
82+ {win32 , _ } ->
83+ [" minigui.exe" , " minigui_port.exe" , " minigui" , " minigui_port" ];
84+ _ ->
85+ [" minigui" , " minigui_port" , " minigui.exe" , " minigui_port.exe" ]
86+ end ,
87+ [filename :absname (filename :join ([Dir , Name ])) || Name <- Names ].
88+
8489first_existing ([]) ->
8590 error ;
8691first_existing ([Path | Rest ]) ->
@@ -228,9 +233,9 @@ normalize_arch(Str) ->
228233
229234release_base_url () ->
230235 % % Recommended: publish binaries by version, e.g.:
231- % % https://github.com/Aztekode/minigui/releases/download/v0.1.0
236+ % % https://github.com/Aztekode/minigui/releases/download/v0.1.1
232237 % % Allows environment override:
233- % % MINIGUI_RELEASE_BASE_URL="https://.../download/v0.1.0 "
238+ % % MINIGUI_RELEASE_BASE_URL="https://.../download/v0.1.1 "
234239 case os :getenv (" MINIGUI_RELEASE_BASE_URL" ) of
235240 false ->
236241 DefaultRepo = " https://github.com/Aztekode/minigui/releases/download" ,
0 commit comments