Refactored LoxideLibs
Build Library / Build Library (push) Successful in 5m30s

1. Added compatibility check, LoxideLibs will now abort the entire program if OS is not linux or windows.
2. Changed the python data extraction compatibility layer, LoxideLibs was calling the extract data function twice, causing very slight overhead. I have now changed this so that the function returns a Struct that is now easily extractable via dot method notation.
This commit is contained in:
brotoskyj
2025-12-11 11:47:50 -05:00
parent 0ac3b54d89
commit 59bb97ec4e
6 changed files with 32 additions and 39 deletions
+8 -9
View File
@@ -11,14 +11,9 @@ pub fn pull_policy_exec_histories(
exec_types: String,
days: i64,
) -> Py<PyString> {
let headers: HeaderMap = match PyData::convert(py, &py_self, true) {
ExtractedValues::Headers(h) => h,
ExtractedValues::BaseUrl(_) => std::process::abort(),
};
let base_url: String = match PyData::convert(py, &py_self, false) {
ExtractedValues::Headers(_) => std::process::abort(),
ExtractedValues::BaseUrl(b) => b,
};
let data = PyData::extract_data(py, &py_self);
let headers = data.headers;
let base_url = data.base_url;
let handle: thread::JoinHandle<String> = std::thread::spawn(move || {
let rt: tokio::runtime::Runtime = match tokio::runtime::Runtime::new() {
Ok(rt) => rt,
@@ -310,7 +305,11 @@ pub fn get_base_directory() -> PathBuf {
.unwrap_or_else(|| home.join("AppData").join("Roaming"));
appdata.join("Loxide")
}
_ => home.join(".local").join("share").join("Loxide"),
"linux" => home.join(".local").join("share").join("Loxide"),
_ => {
println!("{} is currently not compatible with LoxideLibs", os);
std::process::abort();
}
}
}