Page 1 of 1

IOException: Cannot create file because a file with the same name already exists

Posted: Wed May 04, 2022 4:05 pm
by derkoi
I'm having an odd issue, I'm working on an update to my already released mobile game & all is well aside from this odd bug when I try to save the game.
[Exception] IOException: Cannot create /data/app/~~S4z01UT0zClp599fwVqtQg==/com.---.--------------6nSYXB940alzExsSKHtWmg==/base.apk because a file with the same name already exists.
System.IO.Directory.CreateDirectory (System.String path) (at <00000000000000000000000000000000>:0)
ES3Internal.ES3FileStream.GetPath (System.String path, ES3Internal.ES3FileMode fileMode) (at <00000000000000000000000000000000>:0)
ES3Internal.ES3FileStream..ctor (System.String path, ES3Internal.ES3FileMode fileMode, System.Int32 bufferSize, System.Boolean useAsync) (at <00000000000000000000000000000000>:0)
ES3Internal.ES3Stream.CreateStream (ES3Settings settings, ES3Internal.ES3FileMode fileMode) (at <00000000000000000000000000000000>:0)
ES3Writer.Create (ES3Settings settings, System.Boolean writeHeaderAndFooter, System.Boolean overwriteKeys, System.Boolean append) (at <00000000000000000000000000000000>:0)
ES3.Save[T] (System.String key, T value, ES3Settings settings) (at <00000000000000000000000000000000>:0)
DDIGameDataManager.SaveData () (at <00000000000000000000000000000000>:0)
I am using an old version, v3.3.2f6 as I didn't want to break anything by updating as I also use the online save feature on my website.

I suppose I should update and see if the problem persists but wasn't sure if it's a known issue?

Thanks

Re: IOException: Cannot create file because a file with the same name already exists

Posted: Wed May 04, 2022 4:30 pm
by Joel
Hi there,

I've not seen this issue before. However, judging by the path, it looks like you might be trying to use Application.dataPath rather than Application.persistentDataPath (the latter of which Easy Save uses by default). Application.dataPath points to the APK on Android and is not a writable path.

All the best,
Joel

Re: IOException: Cannot create file because a file with the same name already exists

Posted: Wed May 04, 2022 6:05 pm
by derkoi
Hi, thanks for your quick reply.

It seems that was the issue. No idea why I changed it, but it's been a while since I updated the game so I've likely forgotten :roll: :lol:

Re: IOException: Cannot create file because a file with the same name already exists

Posted: Wed May 04, 2022 6:49 pm
by Joel
Glad that resolved the issue, let me know if you run into anything else :)

All the best,
Joel