pub fn copy_binary(
binary_name: &str,
source_dir: &Path,
target_dir: &Path,
) -> Result<PathBuf, String>
Expand description
Copy the binary file to the specified directory.
§Parameters
binary_name
- The name of the binary file to copy.source_dir
- The path to the source file directory.target_dir
- The path to the target directory.
§Return
If successful, return the target path PathBuf
。
On failure, returns a string describing the error.
§Example
let source_dir = std::path::Path::new(".");
let target_dir = std::path::Path::new("/usr/local/bin");
let result = init_rs::copy_binary("example_binary", source_dir, target_dir);
assert!(result.is_ok());