Skip to content

Commit d4db820

Browse files
committed
update wellKnownDirectories function
1 parent f72db58 commit d4db820

File tree

3 files changed

+9
-44
lines changed

3 files changed

+9
-44
lines changed

go.sum

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG
4242
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
4343
github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s=
4444
github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE=
45-
github.com/charmbracelet/x/exp/term v0.0.0-20240510181320-e66de7a51531 h1:RPb7LB50mGIt9KAGz0rJ+SBYRi5gg74TwvKquCN7XBM=
46-
github.com/charmbracelet/x/exp/term v0.0.0-20240510181320-e66de7a51531/go.mod h1:YBotIGhfoWhHDlnUpJMkjebGV2pdGRCn1Y4/Nk/vVcU=
47-
github.com/charmbracelet/x/exp/term v0.0.0-20240514163027-fb066ab7c504 h1:VE+SqWjHen4wQMzScjQeSKF5wmLK00TPG9RjQx1laJ0=
48-
github.com/charmbracelet/x/exp/term v0.0.0-20240514163027-fb066ab7c504/go.mod h1:YBotIGhfoWhHDlnUpJMkjebGV2pdGRCn1Y4/Nk/vVcU=
4945
github.com/charmbracelet/x/exp/term v0.0.0-20240515162549-69ee4f765313 h1:fAAMnqSGV4lwoXfS8ZB7MaLvXayMAAVifUx9sOFRyOo=
5046
github.com/charmbracelet/x/exp/term v0.0.0-20240515162549-69ee4f765313/go.mod h1:YBotIGhfoWhHDlnUpJMkjebGV2pdGRCn1Y4/Nk/vVcU=
5147
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=

src/cmd/main.go

-21
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"log"
99
"net/http"
1010
"os"
11-
"os/exec"
1211
"path/filepath"
1312
"runtime"
1413
"strconv"
@@ -80,26 +79,6 @@ func Run() {
8079
Aliases: []string{"pl"},
8180
Usage: "Print the path to the configuration and directory",
8281
Action: func(c *cli.Context) error {
83-
newDir := "/home/nightcat/.config"
84-
err := os.Chdir(newDir)
85-
if err != nil {
86-
fmt.Println("Error changing directory:", err)
87-
}
88-
89-
// Execute a shell command to change the current directory of the terminal
90-
cmd := exec.Command("cd", newDir)
91-
err = cmd.Run()
92-
if err != nil {
93-
fmt.Println("Error executing command:", err)
94-
}
95-
96-
fmt.Println("Current directory changed to:", newDir)
97-
98-
fmt.Printf(os.Getwd())
99-
if err != nil {
100-
panic(err)
101-
}
102-
10382
fmt.Printf("%-*s %s\n", 55, lipgloss.NewStyle().Foreground(lipgloss.Color("#66b2ff")).Render("[Configuration file path]"), filepath.Join(SuperFileMainDir, configFile))
10483
fmt.Printf("%-*s %s\n", 55, lipgloss.NewStyle().Foreground(lipgloss.Color("#ffcc66")).Render("[Hotkeys file path]"), filepath.Join(SuperFileMainDir, hotkeysFile))
10584
fmt.Printf("%-*s %s\n", 55, lipgloss.NewStyle().Foreground(lipgloss.Color("#66ff66")).Render("[Log file path]"), filepath.Join(SuperFileStateDir, logFile))

src/internal/get_data.go

+9-19
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"encoding/json"
55
"os"
66
"path/filepath"
7-
"runtime"
87

9-
"github.com/rkoesters/xdg/userdirs"
8+
"github.com/adrg/xdg"
109
"github.com/shirou/gopsutil/disk"
1110
)
1211

@@ -34,22 +33,13 @@ func getWellKnownDirectories() []directory {
3433
directories := []directory{}
3534
wellKnownDirectories := []directory{
3635
{location: HomeDir, name: "󰋜 Home"},
37-
{location: userdirs.Download, name: "󰏔 Downloads"},
38-
{location: userdirs.Documents, name: "󰈙 Documents"},
39-
{location: userdirs.Pictures, name: "󰋩 Pictures"},
40-
{location: userdirs.Videos, name: "󰎁 Videos"},
41-
{location: userdirs.Music, name: "♬ Music"},
42-
{location: userdirs.Templates, name: "󰏢 Templates"},
43-
{location: userdirs.PublicShare, name: " PublicShare"},
44-
}
45-
46-
if runtime.GOOS == "darwin" {
47-
wellKnownDirectories[1].location = HomeDir + "/Downloads/"
48-
wellKnownDirectories[2].location = HomeDir + "/Documents/"
49-
wellKnownDirectories[3].location = HomeDir + "/Pictures/"
50-
wellKnownDirectories[4].location = HomeDir + "/Movies/"
51-
wellKnownDirectories[5].location = HomeDir + "/Music/"
52-
wellKnownDirectories[7].location = HomeDir + "/Public/"
36+
{location: xdg.UserDirs.Download, name: "󰏔 Downloads"},
37+
{location: xdg.UserDirs.Documents, name: "󰈙 Documents"},
38+
{location: xdg.UserDirs.Pictures, name: "󰋩 Pictures"},
39+
{location: xdg.UserDirs.Videos, name: "󰎁 Videos"},
40+
{location: xdg.UserDirs.Music, name: "♬ Music"},
41+
{location: xdg.UserDirs.Templates, name: "󰏢 Templates"},
42+
{location: xdg.UserDirs.PublicShare, name: " PublicShare"},
5343
}
5444

5545
for _, dir := range wellKnownDirectories {
@@ -81,7 +71,7 @@ func getPinnedDirectories() []directory {
8171
return directories
8272
}
8373

84-
// Get external media directories
74+
// Get external media directories
8575
func getExternalMediaFolders() (disks []directory) {
8676
parts, err := disk.Partitions(true)
8777

0 commit comments

Comments
 (0)