# copyself A small Windows VPC utility used by `viperc --build-self`. ## Build ```powershell viperc --project ViperC\copyself\project.vpj --clean ``` Output: `ViperC\copyself\__vpcbuild__\output\copyself.exe`. ## Usage ```text copyself ``` - Waits `` seconds, then copies `` to ``. - 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 ```powershell 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: ```text 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.