Renaming a file inside a coordinated write

I believe that if I rename a file, I'm supposed to do that inside a coordinated write on the parent directory - right?

So say I have a file /path/to/folder/f1 and I want to rename it (in the same directory) as /path/to/folder/f2.

I do a coordinated write (with the forMoving option) on the directory /path/to/folder. That passes me a possibly different path to the directory, right? Say I get /path/to/different.

Question: what rename should I actually do? Do I need to construct from and to paths based on the different path that is passed to the accessor? I.e. do I

rename from /path/to/folder/f1 to /path/to/folder/f2 or rename from /path/to/different/f1 to /path/to/different/f2 or some other combination?

Do NSFileManager's renaming methods do anything special in this regard? Can I use e.g. std::filesystem::rename()?

I am interested in both local documents that are visible e.g. in the Files app, and iCloud Drive documents, if that makes any difference.

Thanks!

Renaming a file inside a coordinated write
 
 
Q