MCPcopy Create free account
hub / github.com/codename-co/stack / load_stacks

Function load_stacks

packages/app/src-tauri/src/init.rs:5–24  ·  view source on GitHub ↗

Run the initialization stacks in "extra/*.stack"

(
    app: &tauri::AppHandle,
    stack_start: impl Fn(&str) -> String,
)

Source from the content-addressed store, hash-verified

3
4/// Run the initialization stacks in "extra/*.stack"
5pub fn load_stacks(
6 app: &tauri::AppHandle,
7 stack_start: impl Fn(&str) -> String,
8) -> Result<(), String> {
9 log::info!("Loading stacks");
10 let directory = app
11 .path()
12 .resolve("extra", BaseDirectory::Resource)
13 .unwrap();
14 for entry in directory.read_dir().unwrap() {
15 let path = entry.unwrap().path();
16 if path.extension().and_then(|ext| ext.to_str()) == Some("stack") {
17 let path_str = path.display().to_string();
18 log::info!("Running initialization stack: {:#?}", path_str);
19 stack_start(&path_str);
20 }
21 }
22
23 Ok(())
24}

Callers 1

init_stacksFunction · 0.85

Calls 1

stack_startFunction · 0.85

Tested by

no test coverage detected