mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
fix offline build (#47)
This commit is contained in:
24
ffi/build.rs
24
ffi/build.rs
@@ -35,14 +35,22 @@ fn main() {
|
|||||||
.expect("Unable to generate bindings")
|
.expect("Unable to generate bindings")
|
||||||
.write_to_file("idevice.h");
|
.write_to_file("idevice.h");
|
||||||
|
|
||||||
// download plist.h
|
// Check if plist.h exists locally first, otherwise download
|
||||||
let h = ureq::get("https://raw.githubusercontent.com/libimobiledevice/libplist/refs/heads/master/include/plist/plist.h")
|
let plist_h_path = "plist.h";
|
||||||
.call()
|
let h = if std::path::Path::new(plist_h_path).exists() {
|
||||||
.expect("failed to download plist.h");
|
std::fs::read_to_string(plist_h_path)
|
||||||
let h = h
|
.expect("failed to read plist.h")
|
||||||
.into_body()
|
} else {
|
||||||
.read_to_string()
|
// download plist.h
|
||||||
.expect("failed to get string content");
|
let h = ureq::get("https://raw.githubusercontent.com/libimobiledevice/libplist/refs/heads/master/include/plist/plist.h")
|
||||||
|
.call()
|
||||||
|
.expect("failed to download plist.h");
|
||||||
|
h
|
||||||
|
.into_body()
|
||||||
|
.read_to_string()
|
||||||
|
.expect("failed to get string content")
|
||||||
|
};
|
||||||
|
|
||||||
let mut f = OpenOptions::new().append(true).open("idevice.h").unwrap();
|
let mut f = OpenOptions::new().append(true).open("idevice.h").unwrap();
|
||||||
f.write_all(b"\n\n\n").unwrap();
|
f.write_all(b"\n\n\n").unwrap();
|
||||||
f.write_all(&h.into_bytes())
|
f.write_all(&h.into_bytes())
|
||||||
|
|||||||
Reference in New Issue
Block a user