DirectoryNotFoundException with full existing path... ? How can this be? I need an answer ASAP

So, I’m getting this HUGE error, and I don’t really know what to do about it…


DirectoryNotFoundException: Could not find a part of the path “C:\Users\multi\Desktop\Project P\Assets\StreamingAssets\Saves\A New Game\game_manager.json”.
System.IO.FileStream…ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:292)
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.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter…ctor (System.String path, Boolean append, System.Text.Encoding encoding)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:626)
System.IO.File.WriteAllText (System.String path, System.String contents) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:621)
GameManager+c__Iterator0.MoveNext () (at Assets/GameManager.cs:123)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
GameManager:LoadGame() (at Assets/GameManager.cs:89)
SavesLoader:m__0() (at Assets/UI/SavesLoader.cs:63)
UnityEngine.EventSystems.EventSystem:Update()


Eh… Could someone help me please? The path exists, and there is no reason for it to not save the file…
This is how I save my files:

 string newFile = JsonUtility.ToJson(managerJSON);
 File.WriteAllText(SaveDirectory + "game_manager.json", newFile);

For some reason my “A New Game” folder is read only. does this mess with my system for some reason?
Thanks in advance.

Found the solution:

string newFile = JsonUtility.ToJson(managerJSON);
System.IO.FileInfo file = new System.IO.FileInfo(SaveDirectory + "game_manager.json");
file.Directory.Create();
System.IO.File.WriteAllText(file.FullName, newFile);

You can find it here.