Files
ViperC/copyself
TermiNexus 782b4d63ff feat(build): 增加 --build-self 与 copyself
- 新增 copyself:延迟后删除目标并复制文件/目录
- ViperC 新增 --build-self:自举到 __vpcbuild_2__ 后由 copyself 替换 __vpcbuild__
- 同步当前 ViperC 工作区已有的 Gen/Diag/Stub 改动
- .gitignore 忽略 __vpcbuild_* 与 _sha1_map.txt
2026-10-26 02:09:45 +08:00
..

copyself

A small Windows VPC utility used by viperc --build-self.

Build

viperc --project ViperC\copyself\project.vpj --clean

Output: ViperC\copyself\__vpcbuild__\output\copyself.exe.

Usage

copyself <seconds> <source> <destination>
  • Waits <seconds> seconds, then copies <source> to <destination>.
  • Existing destination is removed first: files are deleted, directories are removed recursively.
  • Source file, destination file: deletes the destination file, then copies the source file.
  • Source directory, destination directory: removes the destination directory, recreates it, then copies the source directory contents.
  • Source file + destination directory, or source directory + destination file: reports an error and does not copy.
  • Missing destination directories are created.
  • File operation failures print the path and the Win32 error code.
  • Source and destination must not be the same path; a destination inside the source directory is rejected.
  • A source directory inside the destination directory is rejected because the destination is removed first.

Example

cd ViperC\copyself\__vpcbuild__\output
copyself.exe 5 ../../../__vpcbuild_2__ ../../../__vpcbuild__

Used by viperc --build-self

viperc --build-self locates the ViperC tree from viperc.exe's own path (not from the current working directory), compiles ViperC into ViperC\__vpcbuild_2__, then launches:

copyself.exe 5 ../../__vpcbuild_2__ ../../__vpcbuild__

from working directory ViperC\copyself\output; the executable itself may live in copyself\output or copyself\__vpcbuild__\output. Build copyself.exe first with the command above; --build-self reports the missing executable and the build command if it is absent.