#How do I authorize permission and execute user-selected executables
4 messages · Page 1 of 1 (latest)
I have resorted to this.
Will figure out how to handle multiple envs later
#[tauri::command]
fn grant_python_permission(
path: &str,
app_handle: tauri::AppHandle,
) -> std::result::Result<(), tauri::Error> {
log::info!("Granting python permission for {}", path);
app_handle.add_capability(
CapabilityBuilder::new(format!("python-interpreter-{}", path))
.webview("main")
.window("main")
.permission_scoped(
"shell:allow-execute",
vec![json!(
{
"name": "python",
"cmd": path,
"sidecar": false,
"args": [
"-c",
{
"validator": ".+",
}
]
}
)],
vec![],
),
)
}