I’m running into a strange error with okio on iOS....
# squarelibraries
l
I’m running into a strange error with okio on iOS. I need to create a folder if it doesn’t exist, so I have a line that says
if(!fileSystem.exists(path)) fileSystem.createDirectory(path, true)
. I also have a log on the line before printing the value of the exists check. In my logs, I see
Copy code
Does it exist yet? false
Uncaught Kotlin exception: okio.IOException: File exists
I know that this function will only run on the main thread, so it’s not a threading issue, and I’m using FileSystem.SYSTEM on iOS. If I set mustCreate to false, then it runs the createDirectory line, but no folder is created. Logs also show that the parent path exists and is definitely in my app’s folder.
Looks like a folder with the same name, but different case sensitivity already existed. Since macOS is not case sensitive, the folders were seen as the same thing on iOS simulator. I wonder why exists(path) didn’t catch this? Is this a bug that should be fixed?
It looks like this behavior is different on iosSimulator and ios.
293 Views