diff --git a/build.rs b/build.rs index 58cb6e6..caca16d 100644 --- a/build.rs +++ b/build.rs @@ -67,7 +67,8 @@ fn link_libraries() { } fn get_lbug_root() -> PathBuf { - let manifest_dir = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap()); + let manifest_dir_str = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + let manifest_dir = Path::new(&manifest_dir_str); let root = manifest_dir.join("lbug-src"); if root.is_symlink() || root.is_dir() { return root; @@ -78,18 +79,18 @@ fn get_lbug_root() -> PathBuf { let lbug_dir = manifest_dir.join("lbug-src"); if !lbug_dir.exists() { - let version = std::env::var("LBUG_VERSION").unwrap_or_else(|| "main".to_string()); + let version = std::env::var("LBUG_VERSION").unwrap_or_else(|_| "main".to_string()); println!("Downloading ladybug source version {version}..."); let url = if version.starts_with('v') { format!( - "https://github.com/lbugdb/lbug/archive/refs/tags/{}.tar.gz", + "https://github.com/LadybugDB/ladybug/archive/refs/tags/{}.tar.gz", version ) } else if version == "main" { - "https://github.com/lbugdb/lbug/archive/refs/heads/main.tar.gz".to_string() + "https://github.com/LadybugDB/ladybug/archive/refs/heads/main.tar.gz".to_string() } else { format!( - "https://github.com/lbugdb/lbug/archive/refs/tags/v{}.tar.gz", + "https://github.com/LadybugDB/ladybug/archive/refs/tags/v{}.tar.gz", version ) }; @@ -106,9 +107,17 @@ fn get_lbug_root() -> PathBuf { panic!("Failed to download ladybug source from {}", url); } + std::fs::create_dir_all(&lbug_dir).expect("Failed to create lbug-src directory"); std::process::Command::new("tar") - .args(["-xzf", "ladybug.tar.gz", "--strip-components=1"]) + .args([ + "-xzf", + "ladybug.tar.gz", + "--strip-components=1", + "-C", + "lbug-src", + ]) .current_dir(manifest_dir) + .status() .expect("Failed to extract ladybug source"); std::fs::remove_file(manifest_dir.join("ladybug.tar.gz")).ok(); diff --git a/lbug-src b/lbug-src deleted file mode 120000 index c25bddb..0000000 --- a/lbug-src +++ /dev/null @@ -1 +0,0 @@ -../.. \ No newline at end of file