mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
improve export data as hex for gres
This commit is contained in:
@ -8,6 +8,8 @@ package gres
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gogf/gf/os/gtime"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -209,8 +211,10 @@ func (r *Resource) doScanDir(path string, pattern string, recursive bool, onlyFi
|
||||
|
||||
// Dump prints the files of current resource object.
|
||||
func (r *Resource) Dump() {
|
||||
var info os.FileInfo
|
||||
r.tree.Iterator(func(key, value interface{}) bool {
|
||||
fmt.Printf("%7s %s\n", gfile.FormatSize(value.(*File).FileInfo().Size()), key)
|
||||
info = value.(*File).FileInfo()
|
||||
fmt.Printf("%v %7s %s\n", gtime.New(info.ModTime()).ISO8601(), gfile.FormatSize(info.Size()), key)
|
||||
return true
|
||||
})
|
||||
fmt.Printf("TOTAL FILES: %d\n", r.tree.Size())
|
||||
|
||||
@ -10,15 +10,14 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/gogf/gf/debug/gdebug"
|
||||
"github.com/gogf/gf/os/gfile"
|
||||
"github.com/gogf/gf/os/gres"
|
||||
"github.com/gogf/gf/test/gtest"
|
||||
)
|
||||
|
||||
func Test_Export(t *testing.T) {
|
||||
gtest.Case(t, func() {
|
||||
srcPath := gfile.Dir(gdebug.CallerFilePath()) + "/testdata/files"
|
||||
goFilePath := gfile.Dir(gdebug.CallerFilePath()) + "/testdata/testdata.go"
|
||||
srcPath := gdebug.CallerDirectory() + "/testdata/files"
|
||||
goFilePath := gdebug.CallerDirectory() + "/testdata/testdata.go"
|
||||
pkgName := "testdata"
|
||||
err := gres.PackToGoFile(srcPath, goFilePath, pkgName)
|
||||
gtest.Assert(err, nil)
|
||||
|
||||
2
os/gres/testdata/testdata.go
vendored
2
os/gres/testdata/testdata.go
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user