Skip to content

Commit

Permalink
Merge pull request #347 from cogentcore/filetreefunc
Browse files Browse the repository at this point in the history
use new filetree.FilterFunc to filter out .DS_Store files
  • Loading branch information
kkoreilly authored Aug 29, 2024
2 parents 5c94b88 + 9bae29f commit 748f1d6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package code

import (
"fmt"
"io/fs"
"log"
"log/slog"
"os"
Expand Down Expand Up @@ -135,6 +136,12 @@ func (cv *Code) Init() {
tree.AddChildAt(w, "filetree", func(w *filetree.Tree) {
w.OpenDepth = 4
cv.Files = w
w.FilterFunc = func(path string, info fs.FileInfo) bool {
if info.Name() == ".DS_Store" {
return false
}
return true
}
w.FileNodeType = types.For[FileNode]()

w.OnSelect(func(e events.Event) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module cogentcore.org/cogent
go 1.22

require (
cogentcore.org/core v0.3.3-0.20240825182959-fe4840922a21
cogentcore.org/core v0.3.3-0.20240829215614-d202a4746d8b
github.com/aandrew-me/tgpt/v2 v2.7.2
github.com/alecthomas/chroma/v2 v2.13.0
github.com/bogdanfinn/fhttp v0.5.27
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cogentcore.org/core v0.3.3-0.20240825182959-fe4840922a21 h1:tffR0tewNHVE36GpZE7ZjTSE4KYoRfbdeL9btV8UmbU=
cogentcore.org/core v0.3.3-0.20240825182959-fe4840922a21/go.mod h1:dg3uRsPcd8S1ZYvRD2TztCtjopRkrB5V/lbl54xsQd4=
cogentcore.org/core v0.3.3-0.20240829215614-d202a4746d8b h1:K5NhkLrQaM9wNjD+cwVwALzTdLzvPeweA+DjgHiv19A=
cogentcore.org/core v0.3.3-0.20240829215614-d202a4746d8b/go.mod h1:dg3uRsPcd8S1ZYvRD2TztCtjopRkrB5V/lbl54xsQd4=
github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4 h1:6lx9xzJAhdjq0LvVfbITeC3IH9Fzvo1aBahyPu2FuG8=
github.com/Bios-Marcel/wastebasket v0.0.4-0.20240213135800-f26f1ae0a7c4/go.mod h1:FChzXi1izqzdPb6BiNZmcZLGyTYiT61iGx9Rxx9GNeI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
Expand Down

0 comments on commit 748f1d6

Please sign in to comment.