Directory Not Found Exception

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
lucsilverberg
Posts: 3
Joined: Wed Jul 11, 2018 8:06 am

Directory Not Found Exception

Post by lucsilverberg »

Hi All,
i've been stuck dealing with this bugs from my game. The problem is, some players complained that the game wasn't saving their progression, and our QA is having a problem reproducing these bugs, it only happen on several players yet, on Android and iOS.

this is the Error i received from unity performance report :

DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/xxxxxxxx
( xxxx is our save file name )

This is the details for the problem :

Code: Select all

 Managed Stack Trace:
System.IO.File.Delete (System.String path)
ES2FileUtility.Delete (System.String path)
ES2FileStream.Store ()
ES2Writer.Save (Boolean checkForOverwrite)
ES2Writer.Save ()
ES2.Save[String] (System.Collections.Generic.HashSet`1 param, System.String identifier, .ES2Settings settings)
another stack trace :

Code: Select all

  Managed Stack Trace:
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.File.OpenRead (System.String path)
System.IO.File.ReadAllBytes (System.String path)
ES2FileUtility.ReadAllBytes (System.String path)
ES2FileStream.CreateReadStream ()
ES2FileStream..ctor (.ES2Settings settings, Operation operation)
ES2Stream.Create (.ES2Settings settings, Operation operation)
ES2Reader..ctor (.ES2Settings settings)
ES2Reader.Create (.ES2Settings settings)
ES2Writer.Delete ()
ES2Writer.Save (Boolean checkForOverwrite)
ES2Writer.Save ()
Is this the cause of our save data problem? how can i fix it?

I'm using Unity 2017.3.1

Thank you.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Directory Not Found Exception

Post by Joel »

Hi there,

Firstly just to check, are you using a recent version of Easy Save? There was a workaround added in 3.0 which addressed an issue which could cause an error message similar to this.

If you are, is there any other information you have which can help replicate it? We've not had any reports of this, so it's not possible for me to replicate it at my end without further information.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
lucsilverberg
Posts: 3
Joined: Wed Jul 11, 2018 8:06 am

Re: Directory Not Found Exception

Post by lucsilverberg »

Hello Joel,

Yes, we are using the newest version of Easy Save, but Easy Save 2, not Easy Save 3.

The stack trace is included in my first post, and there's no other information regarding this issue. We are still trying to reach out to the players to know what they were doing before the problem occured.

Thank you.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Directory Not Found Exception

Post by Joel »

Hi there,

Would you be able to run the following code on device and check to see if the output points to the same directory as the error message?
Debug.Log(Application.persistentDataPath);
If so, it looks like this is a bug at Unity's end. We use their Application.persistentDataPath as the default save location because this is the only place they guarantee will exist and be writable at runtime. If this location does not exist at runtime, then something has definitely gone wrong at their end. If this is the case, I would recommend contacting them ASAP, and providing them with a bug report, as this is a critical issue at their end which I imagine they will want to fix ASAP.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
lucsilverberg
Posts: 3
Joined: Wed Jul 11, 2018 8:06 am

Re: Directory Not Found Exception

Post by lucsilverberg »

Hi Joel,

Yes, the path is same when i tried to debug the persistentDataPath.

Anyway i found some odd problem, here are the error log:

Code: Select all

 DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/com.xxx.xxxx/files/saveFileName.dattmp"
but sometimes it appear as :

Code: Select all

 DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/com.bundle.game/files/saveFileName.dat"
Sometime the save data have ".dat" extension, yet sometimes the save data have ".tmp" or ".dattmp" as extension, is that normal?

Thank you
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Directory Not Found Exception

Post by Joel »

Hi there,

As it looks like the persistentDataPath doesn't exist, you will need to send a bug report to Unity, as this is definitely a bug at their end. They guarantee that this path exists and is writable, so if it isn't, this is something they will want to fix quite quickly.

With regards to the different extensions, this is normal. Easy Save creates a temporary file to write data to, so the error will be thrown depending on which part of the writing process Easy Save is at.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Locked