MCPcopy Create free account
hub / github.com/agentcodee/cursor-free-everyday / get_cursor_version

Function get_cursor_version

reset_machine.rs:304–328  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

302}
303
304fn get_cursor_version() -> Option<String> {
305 if let Some(package_path) = get_cursor_package_path() {
306 if package_path.exists() {
307 match fs::read_to_string(&package_path) {
308 Ok(contents) => match serde_json::from_str::<PackageJson>(&contents) {
309 Ok(json) => Some(json.version),
310 Err(e) => {
311 println!("{} Failed to parse package.json: {}", "[ERROR]".color(RED), e);
312 None
313 }
314 },
315 Err(e) => {
316 println!("{} Failed to read package.json at {:?}: {}", "[ERROR]".color(RED), package_path, e);
317 None
318 }
319 }
320 } else {
321 println!("{} package.json not found at {:?}", "[WARNING]".color(YELLOW), package_path);
322 None
323 }
324 } else {
325 println!("{} Could not determine path to Cursor's package.json", "[WARNING]".color(YELLOW));
326 None
327 }
328}
329
330fn close_cursor_process(process_name: &str) {
331 let mut sys = System::new_all();

Callers 1

mainFunction · 0.85

Calls 1

get_cursor_package_pathFunction · 0.85

Tested by

no test coverage detected