aiweek-reconstruction/udesk/reply/function.go

41 lines
684 B
Go
Raw Permalink Normal View History

2024-05-18 01:46:35 +08:00
package reply
import (
"aiweek/tools"
"io"
"os"
)
// 加载宏
func excludeMacros() []string {
2024-05-19 00:31:20 +08:00
macros := tools.NewOptionObj().ReadYaml("/conf/udesk.yaml").Macros
2024-05-18 01:46:35 +08:00
return macros
}
func CopyFile(srcPath, destPath string) error {
// 打开源文件
src, err := os.Open(srcPath)
if err != nil {
return err
}
defer src.Close()
// 创建目标文件(这将自动创建任何必需的目录)
dest, err := os.Create(destPath)
if err != nil {
return err
}
defer dest.Close()
// 复制文件内容
if _, err = io.Copy(dest, src); err != nil {
return err
}
// 确保目标文件被写入磁盘
if err := dest.Sync(); err != nil {
return err
}
return nil
}