I’m editing a file as described here.
Except I’m using File::fopen and then fwrite instead of putContent because I need to append to the file and apparently putContent overwrites the whole file. Here’s the code.
$s = 'Stuff I am appending.';
$f = $this->rootFolder->get('somefile.txt')->fopen('a');
if (fwrite($f, $s) != strlen($s)) {
throw new \Exception("Failed to write file");
}
It works fine except it doesn’t seem to trigger desktop syncing. I can see the edits on the server but they don’t show up on my desktop.
On the other hand, if I edit the same file using the built-in Files app it synchronizes immediately and I see the changes on my desktop right away.
Is there something else I need to do in the code to make it sync?