()
| 12 | |
| 13 | |
| 14 | fn 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 | } |
| 34 | fn file_exist(archive: &str) -> bool { |
| 35 | return std::path::Path::new(archive).exists() |
| 36 | } |
nothing calls this directly
no test coverage detected