Juce File and creating directories on Samba shares

I’ve stumbled across weird bugs with Juce on Samba shares. If i create a directory and immediately create another directory or write an audio file inside it, weird things happen.

  1. Creating a directory under a new directory fails with error message “Cannot create a file when that file already exists”.
  2. Writing audio to a new (wav) file under the new directory corrupts the file.

In case 2, the data is actually correct, but the Windows filesystem thinks the wav file is now a directory and any attempt to access it fails with obscure error messages like “The directory name is invalid”. Copying the file in Windows to another location fixes it. Only the first audio file gets corrupt. The following files are just fine. In both cases the first File::createDirectory succeeds without an error result.

I suspected that the entry/record for the first directory has not been fully updated to the filesystem at the time the child file is created, and hacked a 100ms sleep after creating the directory - just to see what happens and guess what - according to my client the problem went away.

This looks to me like Juce is returning from File::createDirectory before it should. Has anyone any idea what could be the problem here?

I haven’t yet managed to get a setup for reproducing this in my development environment, so i only have reports from my client.

Can’t imagine what Juce could do more than call Win32 CreateDirectoryW though, which it does… doesn’t look like a Juce bug at all. Still, anyone had this problem on Windows and Samba?