copyPathSync function
Implementation
int copyPathSync(String from, String to) {
if (_doNothing(from, to)) {
return opNone;
}
final dir = Directory(from);
if (!dir.existsSync()) {
return opNotExists;
}
Directory(to).createSync(recursive: true);
for (final file in dir.listSync(recursive: true)) {
final copyTo = p.join(to, p.relative(file.path, from: from));
if (file is Directory) {
Directory(copyTo).createSync(recursive: true);
} else if (file is File) {
File(file.path).copySync(copyTo);
} else if (file is Link) {
Link(copyTo).createSync(file.targetSync(), recursive: true);
}
}
return opOK;
}