package main

import (
	"fmt"
	"io/fs"

	"git.zkcoi.com/zkcoi/meshray/web"
)

func main() {
	fmt.Println("=== 测试 WebAssets ===")

	count := 0
	err := fs.WalkDir(web.WebAssets, ".", func(path string, d fs.DirEntry, err error) error {
		if err != nil {
			return err
		}
		info, _ := d.Info()
		fmt.Printf("  %s (%d bytes)\n", path, info.Size())
		count++
		return nil
	})

	if err != nil {
		fmt.Printf("错误：%v\n", err)
	} else {
		fmt.Printf("\n总共 %d 个文件/目录\n", count)

		// 检查 index.html (此时在 dist 目录下)
		if _, err := fs.Stat(web.WebAssets, "dist/index.html"); err == nil {
			fmt.Println("✅ index.html 存在")
		} else {
			fmt.Printf("❌ index.html 不存在：%v\n", err)
		}
	}
}
