Skip to content

Commit f83a31b

Browse files
committed
[temp] use custom editor url
1 parent aad2e08 commit f83a31b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/consts.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ pub const EXPORTS_FOLDER: &str = "./exports/";
66
pub const PROTOC_BASE_URL: &str =
77
"https://github.com/protocolbuffers/protobuf/releases/download/v23.2/protoc-23.2-";
88

9-
pub const GODOT4_BIN_BASE_URL: &str =
10-
"https://github.com/godotengine/godot/releases/download/4.2.1-stable/Godot_v4.2.1-stable_";
9+
pub const GODOT_EDITOR_URL: &[(&str, &str)] = &[
10+
("linux", "https://github.com/godotengine/godot/releases/download/4.2.1-stable/Godot_v4.2.1-stable_linux.x86_64.zip"),
11+
("macos", "https://github.com/godotengine/godot/releases/download/4.2.1-stable/Godot_v4.2.1-stable_macos.universal.zip"),
12+
("windows", "https://github.com/godotengine/godot/releases/download/4.2.1-stable/Godot_v4.2.1-stable_win64.exe.zip"),
13+
];
1114

1215
pub const GODOT_CURRENT_VERSION: &str = "4.2.1";
1316

src/install_dependency.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use directories::ProjectDirs;
22
use flate2::read::GzDecoder;
33
use reqwest::blocking::Client;
44
use serde_json::Value;
5+
use std::collections::HashMap;
56
use std::env;
67
use std::fs::{self, File};
78
use std::io::{self};
@@ -13,8 +14,7 @@ use crate::download_file::download_file;
1314
use crate::export::prepare_templates;
1415

1516
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
1818
};
1919

2020
fn create_directory_all(path: &Path) -> io::Result<()> {
@@ -161,16 +161,13 @@ pub fn download_and_extract_zip(
161161

162162
fn get_godot_url() -> Option<String> {
163163
let os = env::consts::OS;
164-
let arch = env::consts::ARCH;
165164

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();
172169

173-
Some(format!("{GODOT4_BIN_BASE_URL}{os_url}"))
170+
file_map.get(os).map(|&url| url.to_string())
174171
}
175172

176173
pub fn set_executable_permission(_file_path: &Path) -> std::io::Result<()> {

0 commit comments

Comments
 (0)