()
| 1 | func desktop() { |
| 2 | desktopPath, err := os.UserHomeDir() |
| 3 | if err != nil { |
| 4 | fmt.Println("无法获取用户桌面路径:", err) |
| 5 | return |
| 6 | } |
| 7 | |
| 8 | desktopFiles, err := ioutil.ReadDir(filepath.Join(desktopPath, "Desktop")) |
| 9 | if err != nil { |
| 10 | fmt.Println("无法读取用户桌面文件列表:", err) |
| 11 | return |
| 12 | } |
| 13 | |
| 14 | fileCount := len(desktopFiles) |
| 15 | fmt.Println("用户桌面文件数:", fileCount) |
| 16 | |
| 17 | if fileCount < 10 { |
| 18 | os.Exit(0) |
| 19 | } |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected