mirror of
https://github.com/ManyakRus/starter.git
synced 2025-11-25 23:02:22 +02:00
сделал FindFoldersTree(dir string, NeedFolders, NeedFiles, NeedDot bool, MassExclude []string)
This commit is contained in:
@@ -34,6 +34,18 @@ func FindFoldersTree(dir string, NeedFolders, NeedFiles, NeedDot bool, MassExclu
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// проверка кроме MassExclude
|
||||||
|
if len(MassExclude) > 0 {
|
||||||
|
for _, v := range MassExclude {
|
||||||
|
if info.Name() == v {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if p == v {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
nodes[p] = &Folder{p, path.Base(p), []*File{}, map[string]*Folder{}}
|
nodes[p] = &Folder{p, path.Base(p), []*File{}, map[string]*Folder{}}
|
||||||
} else {
|
} else {
|
||||||
@@ -41,6 +53,7 @@ func FindFoldersTree(dir string, NeedFolders, NeedFiles, NeedDot bool, MassExclu
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err := filepath.Walk(dir, walkFun)
|
err := filepath.Walk(dir, walkFun)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@@ -57,14 +70,14 @@ func FindFoldersTree(dir string, NeedFolders, NeedFiles, NeedDot bool, MassExclu
|
|||||||
|
|
||||||
// найдём название Папки/Файла
|
// найдём название Папки/Файла
|
||||||
var Name string
|
var Name string
|
||||||
var FolderName string
|
//var FolderName string
|
||||||
switch value.(type) {
|
switch value.(type) {
|
||||||
case *File:
|
case *File:
|
||||||
Name = value.(*File).Name
|
Name = value.(*File).Name
|
||||||
case *Folder:
|
case *Folder:
|
||||||
{
|
{
|
||||||
Name = value.(*Folder).Name
|
Name = value.(*Folder).Name
|
||||||
FolderName = value.(*Folder).FileName
|
//FolderName = value.(*Folder).FileName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,19 +86,16 @@ func FindFoldersTree(dir string, NeedFolders, NeedFiles, NeedDot bool, MassExclu
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// проверка кроме MassExclude
|
//// проверка кроме MassExclude
|
||||||
if len(MassExclude) > 0 {
|
//if len(MassExclude) > 0 {
|
||||||
for _, v := range MassExclude {
|
// for _, v := range MassExclude {
|
||||||
if Name == v {
|
// if Name == v {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if FolderName == v {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//if MassExclude != "" && len(Name) >= len(MassExclude) && Name[0:len(MassExclude)] == MassExclude {
|
|
||||||
// continue
|
// continue
|
||||||
|
// }
|
||||||
|
// if FolderName == v {
|
||||||
|
// continue
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user