Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions internal/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package command
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -158,8 +159,12 @@ func DefaultOrg(c *Config) (err error) {
log.Infof(bold, "USING DEFAULT LAUNCHPAD ORGANIZATION")

// find launchpad database
tmpDir := os.Getenv("TMPDIR")
lpad.Folder = filepath.Join(tmpDir, "../0/com.apple.dock.launchpad/db")
cmd := exec.Command("getconf", "DARWIN_USER_DIR")
userDir, err := cmd.Output()
if err != nil {
return err
}
lpad.Folder = filepath.Join(strings.TrimRight(string(userDir), "\r\n"), "com.apple.dock.launchpad/db")
lpad.File = filepath.Join(lpad.Folder, "db")
// lpad.File = "./launchpad.db"
if _, err := os.Stat(lpad.File); os.IsNotExist(err) {
Expand Down Expand Up @@ -312,8 +317,12 @@ func SaveConfig(c *Config) (err error) {
}

// find launchpad database
tmpDir := os.Getenv("TMPDIR")
lpad.Folder = filepath.Join(tmpDir, "../0/com.apple.dock.launchpad/db")
cmd := exec.Command("getconf", "DARWIN_USER_DIR")
userDir, err := cmd.Output()
if err != nil {
return err
}
lpad.Folder = filepath.Join(strings.TrimRight(string(userDir), "\r\n"), "com.apple.dock.launchpad/db")
lpad.File = filepath.Join(lpad.Folder, "db")
// lpad.File = "./launchpad.db"
if _, err := os.Stat(lpad.File); os.IsNotExist(err) {
Expand Down Expand Up @@ -462,8 +471,12 @@ func LoadConfig(c *Config) (err error) {
// $TMPDIR../0/com.apple.dock.launchpad/db/db

// find launchpad database
tmpDir := os.Getenv("TMPDIR")
lpad.Folder = filepath.Join(tmpDir, "../0/com.apple.dock.launchpad/db")
cmd := exec.Command("getconf", "DARWIN_USER_DIR")
userDir, err := cmd.Output()
if err != nil {
return err
}
lpad.Folder = filepath.Join(strings.TrimRight(string(userDir), "\r\n"), "com.apple.dock.launchpad/db")
lpad.File = filepath.Join(lpad.Folder, "db")
// lpad.File = "./launchpad-test.db"
if _, err := os.Stat(lpad.File); os.IsNotExist(err) {
Expand Down