MCPcopy Create free account
hub / github.com/NsLearning/LangHelper / script_path

Function script_path

ChatGPT/src-tauri/src/utils.rs:43–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41}
42
43pub 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
60pub fn user_script() -> String {
61 let user_script_content = fs::read_to_string(script_path()).unwrap_or_else(|_| "".to_string());

Callers 2

user_scriptFunction · 0.85
menu_handlerFunction · 0.85

Calls 3

app_rootFunction · 0.85
existsFunction · 0.85
create_fileFunction · 0.85

Tested by

no test coverage detected