MinaPecheux / UnityTutorials-RTS

The code for my series of tutorials on how to make a real-time stategy (RTS) game in the well-know Unity game engine (with C# scripting)!
https://minapecheux.com
MIT License
584 stars 107 forks source link

DirectoryNotFoundException: Could not find a part of the path #5

Closed HDNua closed 2 years ago

HDNua commented 2 years ago

image

I downloaded this project to run it for test. But I've failed to open it. It yields an error like below. I installed Unity 2020.3.18f1 to match with the version that you've uploaded but it still fails.

DirectoryNotFoundException: Could not find a part of the path 'C:\Users\handy\AppData\LocalLow\minapecheux\RTSTutorial\Data_Dev\Games'. System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource].HandleError (System.Int32 hr, System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource].CommonInit () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler1[TSource] resultHandler, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.InternalGetDirectories (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.GetDirectories (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0) DataHandler.GetGamesList () (at Assets/Scripts/Tools/DataHandler.cs:196) MainMenuManager._PopulateLoadsList () (at Assets/Scripts/Managers/MainMenuManager.cs:250) MainMenuManager.Start () (at Assets/Scripts/Managers/MainMenuManager.cs:48)

Can you let me know how I can fix this? Is there someone who has in same situation with me?

Thanks.

MinaPecheux commented 2 years ago

Nice catch! Hopefully the commit f249af7 will fix it... Could you please try to re-pull and tell me if it works?

Thanks! :)

MinaPecheux commented 2 years ago

@HDNua your technique works too but I preferred to return a null and cancel the load if it happens (see https://github.com/MinaPecheux/UnityTutorials-RTS/commit/18fee13e9010b4c5a167765d522b84b2e1319999).

Anyway: big thanks for your interest and help with the project, this was a nasty bug but an easy fix! ^^ I'm closing the issue now. Feel free to re-open another if you still have problems with this or anything else ;) Cheers :)