@@ -2,6 +2,7 @@ use directories::ProjectDirs;
2
2
use flate2:: read:: GzDecoder ;
3
3
use reqwest:: blocking:: Client ;
4
4
use serde_json:: Value ;
5
+ use std:: collections:: HashMap ;
5
6
use std:: env;
6
7
use std:: fs:: { self , File } ;
7
8
use std:: io:: { self } ;
@@ -13,8 +14,7 @@ use crate::download_file::download_file;
13
14
use crate :: export:: prepare_templates;
14
15
15
16
use crate :: consts:: {
16
- BIN_FOLDER , GODOT4_BIN_BASE_URL , GODOT_CURRENT_VERSION , PROTOC_BASE_URL ,
17
- RUST_LIB_PROJECT_FOLDER ,
17
+ BIN_FOLDER , GODOT_CURRENT_VERSION , GODOT_EDITOR_URL , PROTOC_BASE_URL , RUST_LIB_PROJECT_FOLDER
18
18
} ;
19
19
20
20
fn create_directory_all ( path : & Path ) -> io:: Result < ( ) > {
@@ -161,16 +161,13 @@ pub fn download_and_extract_zip(
161
161
162
162
fn get_godot_url ( ) -> Option < String > {
163
163
let os = env:: consts:: OS ;
164
- let arch = env:: consts:: ARCH ;
165
164
166
- let os_url = match ( os, arch) {
167
- ( "linux" , "x86_64" ) => Some ( "linux.x86_64.zip" . to_string ( ) ) ,
168
- ( "windows" , "x86_64" ) => Some ( "win64.exe.zip" . to_string ( ) ) ,
169
- ( "macos" , _) => Some ( "macos.universal.zip" . to_string ( ) ) ,
170
- _ => None ,
171
- } ?;
165
+ let file_map: HashMap < & str , & str > = GODOT_EDITOR_URL
166
+ . iter ( )
167
+ . cloned ( )
168
+ . collect ( ) ;
172
169
173
- Some ( format ! ( "{GODOT4_BIN_BASE_URL}{os_url}" ) )
170
+ file_map . get ( os ) . map ( | & url| url . to_string ( ) )
174
171
}
175
172
176
173
pub fn set_executable_permission ( _file_path : & Path ) -> std:: io:: Result < ( ) > {
0 commit comments