()
| 41 | } |
| 42 | |
| 43 | pub fn script_path() -> PathBuf { |
| 44 | let script_file = app_root().join("main.js"); |
| 45 | if !exists(&script_file) { |
| 46 | create_file(&script_file).unwrap(); |
| 47 | fs::write( |
| 48 | &script_file, |
| 49 | format!( |
| 50 | "// *** ChatGPT User Script ***\n// @github: https://github.com/lencx/ChatGPT \n// @path: {}\n\nconsole.log('🤩 Hello ChatGPT!!!');", |
| 51 | &script_file.to_string_lossy() |
| 52 | ), |
| 53 | ) |
| 54 | .unwrap(); |
| 55 | } |
| 56 | |
| 57 | script_file |
| 58 | } |
| 59 | |
| 60 | pub fn user_script() -> String { |
| 61 | let user_script_content = fs::read_to_string(script_path()).unwrap_or_else(|_| "".to_string()); |
no test coverage detected