copy method

  1. @override
void copy(
  1. String fromAbs,
  2. String toAbs
)
override

Copies fromAbs to toAbs. Auto-creates any missing parent directories at the destination. Overwrites toAbs if present.

@param fromAbs Absolute source path. Must exist. @param toAbs Absolute destination path. @throws FileSystemException When fromAbs is missing.

Implementation

@override
void copy(String fromAbs, String toAbs) {
  // 1. Reject early when the source is missing so the error is identical to
  //    InMemoryFs's `! ` failure mode and matches the documented contract.
  if (!File(fromAbs).existsSync()) {
    throw FileSystemException('Source file not found', fromAbs);
  }
  // 2. Ensure the destination's parent exists; dart:io's File.copySync
  //    refuses to create missing directories.
  FileHelper.ensureDirectoryExists(File(toAbs).parent.path);
  FileHelper.copyFile(fromAbs, toAbs);
}