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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user