MCPcopy Create free account
hub / github.com/DiamondHunters/NodeInject / main

Function main

src/main.rs:14–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14fn main() {
15 if file_exist("./node"){
16 println!("You may have already installed the hook.Please check manually.");
17 return;
18 }
19 if !file_exist("./resources/node_modules.asar") {
20 println!("no node_modules.asar found");
21 println!("move me to the root of your typora installation(the same directory as executable of electron)");
22 return;
23 }
24 println!("extracting node_modules.asar");
25 rasar::extract("./resources/node_modules.asar", "./node").unwrap();
26 println!("adding hook.js");
27 write_js_to_file();
28 println!("applying patch");
29 append_require_to_file();
30 println!("packing node_modules.asar");
31 rasar::pack("./node","./resources/node_modules.asar").unwrap();
32 println!("done!");
33}
34fn file_exist(archive: &str) -> bool {
35 return std::path::Path::new(archive).exists()
36}

Callers

nothing calls this directly

Calls 3

file_existFunction · 0.85
write_js_to_fileFunction · 0.85
append_require_to_fileFunction · 0.85

Tested by

no test coverage detected