Skip to content

Commit 886dbfb

Browse files
committed
update $HOME/.superfile to $HOME/.config/superfile and update trash can path to match The FreeDesktop.org Trash specification
1 parent 41ed813 commit 886dbfb

15 files changed

+69
-41
lines changed

Diff for: .goreleaser.yaml

-23
This file was deleted.

Diff for: changelog.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,31 @@ All notable changes to this project will be documented in this file. Dates are d
77
> 2024/04/xx
88
99
#### Update
10+
11+
- Update $HOME/.superfile to $HOME/.config/superfile [`f6eb9d8`](https://github.com/MHNightCat/superfile/commit/f6eb9d879f9f7ef31859e3f84c8792e2f0fc543a)
12+
- Follow [The FreeDesktop.org Trash specification](https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html) [`f6eb9d8`] to update the trash bin path (https://github.com/MHNightCat/superfile/commit/f6eb9d879f9f7ef31859e3f84c8792e2f0fc543a)
13+
1014
#### Bug fix
11-
- Fix processes bar cursor index display error[`f6eb9d8`](https://github.com/MHNightCat/superfile/commit/f6eb9d879f9f7ef31859e3f84c8792e2f0fc543a)
15+
16+
- Fix processes bar cursor index display error [`f6eb9d8`](https://github.com/MHNightCat/superfile/commit/f6eb9d879f9f7ef31859e3f84c8792e2f0fc543a)
1217

1318
# [**v1.0.0**](https://github.com/MHNightCat/superfile/releases/tag/v1.0.0)
1419

1520
> 2024/04/06
1621
1722
##### Update
23+
1824
- Auto download folder [`96a3a71`](https://github.com/MHNightCat/superfile/commit/96a3a7108eb7c4327bad3424ed55e472ec78049f)
1925
- Auto initialize configuration [`96a3a71`](https://github.com/MHNightCat/superfile/commit/96a3a7108eb7c4327bad3424ed55e472ec78049f)
2026
- Add version subcommand [`ee22df3`](https://github.com/MHNightCat/superfile/commit/ee22df3c7700adddb859ada8623f6c8b038e8087)
27+
2128
##### Bug fix
29+
2230
- Fix creating an Item when the file panel has no Item will cause an error [`9ee1d86`](https://github.com/MHNightCat/superfile/commit/9ee1d860192182803d408c5046ca9f5255121698)
2331
- Fix delete mupulate Item will cause cursor error [`ee22df3`](https://github.com/MHNightCat/superfile/commit/ee22df3c7700adddb859ada8623f6c8b038e8087)
2432

2533
# [**Beta 0.1.0**](https://github.com/MHNightCat/superfile/releases/tag/v0.1.0-beta)
2634

2735
> 2024/04/06
2836
29-
- FIRST RELEASE COME UP! NO ANY CHANGE
37+
- FIRST RELEASE COME UP! NO ANY CHANGE

Diff for: src/.goreleaser.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: 1
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- main: ./main.go
9+
id: "superfile"
10+
binary: spf
11+
goos:
12+
- linux
13+
- darwin
14+
goarch:
15+
- amd64
16+
- arm
17+
- arm64
18+
19+
nfpms:
20+
- maintainer: NightCat <[email protected]>
21+
file_name_template: >-
22+
{{ .PackageName }}-{{ .Version }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}-{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}
23+
description: Pretty fancy and modern file manager in terminal .
24+
homepage: https://github.com/MHNightCat/superfile
25+
bindir: /usr/bin
26+
license: MIT
27+
formats:
28+
- deb
29+
- rpm
30+
- archlinux
31+
32+
archives:
33+
- format: tar.gz
34+
name_template: >-
35+
{{ .ProjectName }}_
36+
{{- title .Os }}_
37+
{{- if eq .Arch "amd64" }}x86_64
38+
{{- else if eq .Arch "386" }}i386
39+
{{- else }}{{ .Arch }}{{ end }}
40+
{{- if .Arm }}v{{ .Arm }}{{ end }}

Diff for: src/components/globalController.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/charmbracelet/bubbles/progress"
1111
"github.com/charmbracelet/bubbles/textinput"
1212
"github.com/lithammer/shortuuid"
13+
"github.com/rkoesters/xdg/trash"
1314
)
1415

1516
/* CURSOR CONTROLLER START */
@@ -334,8 +335,7 @@ func PasteItem(m model) model {
334335
}
335336
if m.copyItems.cut {
336337
for _, item := range m.copyItems.items {
337-
filePath := item
338-
err := MoveFile(item, SuperFileMainDir+trashFolder+"/"+path.Base(filePath))
338+
err := trash.Trash(item)
339339
if err != nil {
340340
OutPutLog("Paste item function move file to trash can error", err)
341341
}

Diff for: src/components/model.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ import (
1313
const (
1414
configFolder string = "/config"
1515
themeFolder string = "/theme"
16-
trashFolder string = "/trash"
1716
dataFolder string = "/data"
1817
lastCheckVersion string = "/data/lastCheckVersion"
1918
pinnedFile string = "/data/pinned.json"
19+
logFile string = "/data/superfile.log"
2020
configFile string = "/config/config.json"
2121
themeZipName string = "/theme.zip"
22-
logFile string = "/superfile.log"
2322
)
2423

2524
var HomeDir = getHomeDir()
26-
var SuperFileMainDir = HomeDir + "/.superfile"
25+
var SuperFileMainDir = HomeDir + "/.config/superfile"
2726

2827
var theme ThemeType
2928
var Config ConfigType

Diff for: src/components/normalModeController.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/charmbracelet/bubbles/progress"
1010
"github.com/charmbracelet/bubbles/textinput"
1111
"github.com/lithammer/shortuuid"
12+
"github.com/rkoesters/xdg/trash"
1213
)
1314

1415
func EnterPanel(m model) model {
@@ -76,7 +77,11 @@ func DeleteSingleItem(m model) model {
7677
processNewState: newProcess,
7778
}
7879

79-
err := MoveFile(panel.element[panel.cursor].location, SuperFileMainDir+trashFolder+"/"+panel.element[panel.cursor].name)
80+
err := trash.Trash(panel.element[panel.cursor].location)
81+
if err != nil {
82+
OutPutLog("Delete single item function move file to trash can error", err)
83+
}
84+
8085
if err != nil {
8186
p := m.processBarModel.process[id]
8287
p.state = failure

Diff for: src/components/selectModeController.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package components
22

33
import (
44
"os"
5-
"path"
65
"path/filepath"
7-
86
"github.com/atotto/clipboard"
97
"github.com/charmbracelet/bubbles/progress"
108
"github.com/lithammer/shortuuid"
9+
"github.com/rkoesters/xdg/trash"
1110
)
1211

1312
func SingleItemSelect(m model) model {
@@ -100,8 +99,10 @@ func DeleteMultipleItem(m model) model {
10099
processNewState: p,
101100
}
102101
}
103-
104-
err := MoveFile(filePath, SuperFileMainDir+trashFolder+"/"+path.Base(filePath))
102+
err := trash.Trash(filePath)
103+
if err != nil {
104+
OutPutLog("Delete single item function move file to trash can error", err)
105+
}
105106

106107
if err != nil {
107108
p.state = failure

Diff for: src/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ require (
2929
github.com/muesli/termenv v0.15.2 // indirect
3030
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
3131
github.com/rivo/uniseg v0.4.6 // indirect
32+
github.com/rkoesters/xdg v0.0.1 // indirect
3233
github.com/russross/blackfriday/v2 v2.1.0 // indirect
3334
github.com/satori/go.uuid v1.2.0 // indirect
3435
github.com/stretchr/testify v1.8.4 // indirect

Diff for: src/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
5454
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
5555
github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg=
5656
github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
57+
github.com/rkoesters/xdg v0.0.1 h1:RmfYxghVvIsb4d51u5LtNOcwqY5r3P44u6o86qqvBMA=
58+
github.com/rkoesters/xdg v0.0.1/go.mod h1:5DcbjvJkY00fIOKkaBnylbC/rmc1NNJP5dmUcnlcm7U=
5759
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
5860
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
5961
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=

Diff for: src/main.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
var HomeDir = getHomeDir()
21-
var SuperFileMainDir = HomeDir + "/.superfile"
21+
var SuperFileMainDir = HomeDir + "/.config/superfile"
2222

2323
const (
2424
currentVersion string = "v1.0.1"
@@ -85,11 +85,6 @@ func InitConfigFile() {
8585
if err != nil {
8686
log.Fatalln("Can't Create Superfile main config folder:", SuperFileMainDir, err)
8787
}
88-
// create trash can folder
89-
err = CreateFolderIfNotExist(SuperFileMainDir + trashFolder)
90-
if err != nil {
91-
log.Fatalln("Can't Create Superfile trash folder:", SuperFileMainDir+trashFolder, err)
92-
}
9388
// create data folder
9489
err = CreateFolderIfNotExist(SuperFileMainDir + dataFolder)
9590
if err != nil {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)