+8
-6
src/resources.rs
+8
-6
src/resources.rs
···
8
8
fn format_url(file_name: &str) -> reqwest::Url {
9
9
let window = web_sys::window().unwrap();
10
10
let location = window.location();
11
-
let mut origin = location.origin().unwrap();
12
-
if !origin.ends_with("res") {
13
-
origin = format!("{}/res", origin);
14
-
}
15
-
let base = reqwest::Url::parse(&format!("{}/", origin)).unwrap();
16
-
base.join(file_name).unwrap()
11
+
// let mut origin = location.pathname().unwrap();
12
+
// if !origin.ends_with("res") {
13
+
// origin = format!("{}/res", origin);
14
+
// }
15
+
// let base = reqwest::Url::parse(&format!("{}/", origin)).unwrap();
16
+
// base.join(file_name).unwrap()
17
+
18
+
reqwest::Url::parse(&format!("{}/../res/{}",location.href().unwrap(), file_name)).unwrap()
17
19
}
18
20
19
21
pub async fn load_string(file_name: &str) -> Result<String, Box<dyn Error>> {