/*
* Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
*/
import std.process.*
import std.fs.*
/*
* called after `cjpm build`
*/
func stagePostBuild(): Int64 {
let structPath: String = Process.current.workingDirectory.toString()
let buildPath: Path = Path("${structPath}/target/release/pinyin4cj/pinyin.dict.txt")
let targetPath: Path = Path("${structPath}/target/release/pinyin4cj/pinyin.dict.txt")
let testPath: Path = Path("${structPath}/resource/pinyin.dict.txt")
if (exists(targetPath)) {
remove(targetPath, recursive: true)
}
copy(testPath, to: buildPath, overwrite: false)
0
}
main(){
match (Process.current.arguments[0]) {
case "post-build" => stagePostBuild()
case _ => 0
}
}