mirror of
https://github.com/tw93/Mole.git
synced 2026-02-14 14:42:25 +00:00
fix(windows): address code review issues
- Fix openInExplorer to actually execute explorer.exe (was a no-op) - Load System.Windows.Forms assembly before using Clipboard - Use Remove-SafeItem in purge for consistent safety checks - Fix Dropbox typo (was DroplboxCache)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
@@ -671,19 +672,11 @@ func truncatePath(path string, maxLen int) string {
|
||||
// openInExplorer opens a path in Windows Explorer
|
||||
func openInExplorer(path string) {
|
||||
// Use explorer.exe to open the path
|
||||
cmd := fmt.Sprintf("explorer.exe /select,\"%s\"", path)
|
||||
go func() {
|
||||
_ = runCommand("cmd", "/c", cmd)
|
||||
exec.Command("explorer.exe", "/select,", path).Run()
|
||||
}()
|
||||
}
|
||||
|
||||
// runCommand runs a command and returns the output
|
||||
func runCommand(name string, args ...string) error {
|
||||
cmd := fmt.Sprintf("%s %s", name, strings.Join(args, " "))
|
||||
_ = cmd
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
var startPath string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user