Skip to content

Commit

Permalink
设置操作系统限制
Browse files Browse the repository at this point in the history
  • Loading branch information
林通 committed Aug 14, 2020
1 parent f665a83 commit 44522cb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions content.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
ui "github.com/gizak/termui/v3"
"github.com/gizak/termui/v3/widgets"
"os"
"runtime"
"sort"
"strings"
)
Expand Down Expand Up @@ -97,12 +98,18 @@ func (e EntrySlice) Swap(i, j int) { e[i], e[j] = e[j], e[i] }

// 加载并解析文件
func (c *Content) loadContent() {

var files []string
c.entries = make([]*Entry, 0)
homedir, err := os.UserHomeDir()
if err != nil {
homedir = "/usr/local/bin/"
if runtime.GOOS == "darwin" || runtime.GOOS == "linux"{
homedir, err := os.UserHomeDir()
if err != nil {
homedir = "/usr/local/bin/"
}
files = Files(homedir + "/.files")
} else {
panic("nonsupport system")
}
files := Files(homedir + "/.files")

for _, file := range files {
entries := make([]*Entry, 0)
Expand Down
Binary file modified fastfind
Binary file not shown.
2 changes: 1 addition & 1 deletion install.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
chmod +x fastfind
cp fastfind /usr/local/bin
cp -r files ~/.files
cp -r .files ~/.files
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func main() {
uiEvents := ui.PollEvents()
for {
e := <-uiEvents
//if e.Type != ui.KeyboardEvent {
// continue
//}
if e.Type != ui.KeyboardEvent {
continue
}
var next bool
var repeat = true

Expand Down

0 comments on commit 44522cb

Please sign in to comment.