copyFile method
Copies a file from source to destination.
Implementation
File copyFile(String srcPath, String destPath) {
try {
final srcFile = File(srcPath);
if (!srcFile.existsSync()) {
throw CliException('Source file does not exist at $srcPath');
}
final destFile = File(destPath);
final parentDir = destFile.parent;
if (!parentDir.existsSync()) {
parentDir.createSync(recursive: true);
}
return srcFile.copySync(destPath);
} catch (e) {
throw CliException('Failed to copy file from $srcPath to $destPath', e);
}
}