From ddf90e86a38b8f1f0bde6a869fb3ad9a8e48b0ab Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 24 Jul 2022 16:43:14 +0800 Subject: [PATCH] Rename lastIsLeaf. --- object/store_provider.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/object/store_provider.go b/object/store_provider.go index d4a1a61..c579157 100644 --- a/object/store_provider.go +++ b/object/store_provider.go @@ -8,7 +8,7 @@ import ( "github.com/casbin/casbase/util" ) -func (store *Store) createPathIfNotExisted(tokens []string, lastModifiedTime string, lastIsLeaf bool) { +func (store *Store) createPathIfNotExisted(tokens []string, lastModifiedTime string, isLeaf bool) { currentFile := store.FileTree if currentFile == nil { currentFile = &File{ @@ -36,16 +36,16 @@ func (store *Store) createPathIfNotExisted(tokens []string, lastModifiedTime str continue } - isLeaf := false + isLeafTmp := false if i == len(tokens)-1 { - isLeaf = lastIsLeaf + isLeafTmp = isLeaf } key := strings.Join(tokens[:i+1], "/") newFile := &File{ Key: key, Title: token, - IsLeaf: isLeaf, + IsLeaf: isLeafTmp, Children: []*File{}, ChildrenMap: map[string]*File{}, } @@ -65,13 +65,13 @@ func (store *Store) Populate() { for _, object := range objects { lastModifiedTime := object.LastModified.Local().Format(time.RFC3339) - lastIsLeaf := true + isLeaf := true if object.Key[len(object.Key)-1] == '/' { - lastIsLeaf = false + isLeaf = false } tokens := strings.Split(strings.Trim(object.Key, "/"), "/") - store.createPathIfNotExisted(tokens, lastModifiedTime, lastIsLeaf) + store.createPathIfNotExisted(tokens, lastModifiedTime, isLeaf) //fmt.Printf("%s, %d, %v\n", object.Key, object.Size, object.LastModified) }