mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
minor clean up
This commit is contained in:
parent
2930263dfd
commit
dbf0de4ce1
|
@ -62,6 +62,10 @@ func (scanner *VolumeFileScanner4Fix) VisitNeedle(n *needle.Needle, offset int64
|
|||
func runFix(cmd *Command, args []string) bool {
|
||||
for _, arg := range args {
|
||||
basePath, f := path.Split(util.ResolvePath(arg))
|
||||
if util.FolderExists(arg) {
|
||||
basePath = arg
|
||||
f = ""
|
||||
}
|
||||
|
||||
files := []fs.DirEntry{}
|
||||
if f == "" {
|
||||
|
@ -72,7 +76,7 @@ func runFix(cmd *Command, args []string) bool {
|
|||
}
|
||||
files = fileInfo
|
||||
} else {
|
||||
fileInfo, err := os.Stat(basePath + f)
|
||||
fileInfo, err := os.Stat(arg)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return false
|
||||
|
|
|
@ -45,6 +45,16 @@ func FileExists(filename string) bool {
|
|||
|
||||
}
|
||||
|
||||
func FolderExists(folder string) bool {
|
||||
|
||||
fileInfo, err := os.Stat(folder)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return fileInfo.IsDir()
|
||||
|
||||
}
|
||||
|
||||
func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Time, fileSize int64) {
|
||||
exists = true
|
||||
fi, err := os.Stat(filename)
|
||||
|
|
Loading…
Reference in a new issue