Alex Yatskov
e408fa9335
commit 106991bfd59bb95977045399f7b4e5f4e7addc56
Author: Alex Yatskov <alex@foosoft.net>
Date: Sat Jan 8 11:19:21 2022 -0800
Rename property functions
commit 07f6033d4e86df257806af16de002ce8fad3d67f
Author: Alex Yatskov <alex@foosoft.net>
Date: Sat Jan 8 11:16:46 2022 -0800
Update rewrite
commit ea2dc0b4d223d54832752f0efd3eb46d81d17b50
Author: Alex Yatskov <alex@foosoft.net>
Date: Fri Jan 7 22:47:17 2022 -0800
Add more property methods
commit e2f7f8dc7ebc5b668539e8233e323a7c256eced2
Author: Alex Yatskov <alex@foosoft.net>
Date: Fri Jan 7 22:39:23 2022 -0800
Add step indexing
commit a7ed2a0b1c95ed9fbb0bbd87c779cf51a92f0b5f
Author: Alex Yatskov <alex@foosoft.net>
Date: Fri Jan 7 20:50:19 2022 -0800
Use self
commit 7ecc01e508c06680dcb6b6ecd4265a7f72e2c933
Author: Alex Yatskov <alex@foosoft.net>
Date: Sun Aug 22 12:33:09 2021 -0700
Cleanup
commit 87dd28a4c14b88bea061ca913f68e272cca787f9
Author: Alex Yatskov <alex@foosoft.net>
Date: Sun Aug 22 12:09:41 2021 -0700
Cleanup
commit 129130128d2a50f119c46f70e7cb70ef421892ff
Merge: 629fce0 e751d70
Author: Alex Yatskov <alex@foosoft.net>
Date: Sat Aug 21 12:18:09 2021 -0700
Merge branch 'master' into dev
commit 629fce06a8fca6810ec772f558d9ffabda016d01
Author: Alex Yatskov <alex@foosoft.net>
Date: Sun Jun 27 19:34:53 2021 -0700
Abstract metadata
50 lines
822 B
Go
50 lines
822 B
Go
package goldsmith
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
type filesByPath []*File
|
|
|
|
func (self filesByPath) Len() int {
|
|
return len(self)
|
|
}
|
|
|
|
func (self filesByPath) Swap(i, j int) {
|
|
self[i], self[j] = self[j], self[i]
|
|
}
|
|
|
|
func (self filesByPath) Less(i, j int) bool {
|
|
return strings.Compare(self[i].Path(), self[j].Path()) < 0
|
|
}
|
|
|
|
type fileInfo struct {
|
|
os.FileInfo
|
|
path string
|
|
}
|
|
|
|
func cleanPath(path string) string {
|
|
if filepath.IsAbs(path) {
|
|
var err error
|
|
if path, err = filepath.Rel("/", path); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
return filepath.Clean(path)
|
|
}
|
|
|
|
func scanDir(rootDir string, infos chan fileInfo) {
|
|
defer close(infos)
|
|
|
|
filepath.Walk(rootDir, func(path string, info os.FileInfo, err error) error {
|
|
if err == nil {
|
|
infos <- fileInfo{FileInfo: info, path: path}
|
|
}
|
|
|
|
return err
|
|
})
|
|
}
|