You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
604 B
36 lines
604 B
package path
|
|
|
|
import (
|
|
"path/filepath"
|
|
"os"
|
|
"fmt"
|
|
)
|
|
|
|
// 模块中要导出的函数,必须首字母大写。
|
|
func Output(path string,) []string {
|
|
var array []string
|
|
err := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {
|
|
if f == nil {
|
|
return err
|
|
}
|
|
if f.IsDir() {
|
|
return nil
|
|
}
|
|
array = append(array, path)
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
fmt.Printf("filepath.Walk() returned %v\n", err)
|
|
}
|
|
return array
|
|
}
|
|
/*
|
|
|
|
*/
|
|
func Abs(path string ) string {
|
|
var absolutePath,err = filepath.Abs(path)
|
|
if err!=nil {
|
|
fmt.Printf("err:", err)
|
|
}
|
|
return absolutePath
|
|
}
|