# FileSystemManager.copyFileSync(string srcPath, string destPath)

同步复制文件到目标路径。

# 支持情况

项 说明
兼容性 兼容微信

# 语法

const fs = mt.getFileSystemManager()
fs.copyFileSync(srcPath, destPath)

# 参数

参数 类型 必填 说明
srcPath string 是 源文件路径
destPath string 是 目标文件路径

# 返回值

void — 成功时无返回值;失败时返回错误信息字符串。

# 示例代码

const fs = mt.getFileSystemManager()
fs.copyFileSync(
  `${mt.env.USER_DATA_PATH}/a.txt`,
  `${mt.env.USER_DATA_PATH}/b.txt`
)

# 与微信差异

无差异(行为与微信小游戏一致)。

上次更新: 8/10/2026, 5:36:37 PM