moveNativeToNative static method

Entity moveNativeToNative(
  1. {required String pathIn,
  2. required String pathOut,
  3. required Native fsIn,
  4. required Native fsOut,
  5. EntityType type = EntityType.file}
)

Implementation

static Entity moveNativeToNative({
  required String pathIn,
  required String pathOut,
  required Native fsIn,
  required Native fsOut,
  EntityType type = EntityType.file,
}) {
  final nPathIn = join(fsIn.root.path, pathIn);
  final nPathOut = join(fsOut.root.path, pathOut);

  if (type == EntityType.file) {
    io.File(nPathIn).renameSync(nPathOut);
    return File(pathOut);
  } else if (type == EntityType.dir) {
    io.Directory(nPathIn).renameSync(nPathOut);
    return Dir(pathOut);
  } else {
    throw "[Virtual filesystem] unsupported format!";
  }
}