Search Issue Tracker
Duplicate
Votes
0
Found in
2017.2.0f3
Issue ID
960173
Regression
No
"FileNotFoundException: Could not find file" error when the path to script file is too long
To reproduce:
1. Download attached project "IssuePathTooLong.zip" and open in Unity
2. Create one more subfolder in "ReallyLongFolderNameWoopWoop 5" folder and put in it "behaviourparent.cs" script
Note: You should see in Console these errors:
"DirectoryNotFoundException: Could not find a part of the path "C:\Users\Jonas\Desktop\Projects\960173\Assets\ReallyLongFolderNameWoopWoop\ReallyLongFolderNameWoopWoop 1\ReallyLongFolderNameWoopWoop 2\ReallyLongFolderNameWoopWoop 3\ReallyLongFolderNameWoopWoop 4\ReallyLongFolderNameWoopWoop 5\reallylongfoldernamewoopwoop 6\behaviourparent.cs".
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.File.OpenRead (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:363)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamReader.cs:167)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding)
(wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string,System.Text.Encoding)
ICSharpCode.NRefactory.ParserFactory.CreateParser (System.String fileName, System.Text.Encoding encoding)
ICSharpCode.NRefactory.ParserFactory.CreateParser (System.String fileName)
UnityEditor.Scripting.Compilers.CSharpLanguage.GetNamespace (System.String fileName, System.String definedSymbols) (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/CSharpLanguage.cs:44)
UnityEditor.Scripting.ScriptCompilers.GetNamespace (System.String file, System.String definedSymbols) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilers.cs:98)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
"
"error CS2001: Source file `Assets/ReallyLongFolderNameWoopWoop/ReallyLongFolderNameWoopWoop 1/ReallyLongFolderNameWoopWoop 2/ReallyLongFolderNameWoopWoop 3/ReallyLongFolderNameWoopWoop 4/ReallyLongFolderNameWoopWoop 5/ReallyLongFolderNameWoopWoop 6/behaviourparent.cs' could not be found
Compilation failed: 1 error(s), 0 warnings"
Reproduced on Unity 5.5.5p1, 5.6.4p2, 2017.1.2p2, 2017.2.0p1, 2017.3.0b8 and 2018.1.0a3
On Unity 2017.1.2p2 it shows only "DirectoryNotFoundException: Could not find a part of the path" error, and on Unity 2017.2.0a2 it shows both errors
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
ThomasLee1
Mar 13, 2018 11:19
I suggest that you use LongPathTool its an amazing tool google it and will solve your problem.
Brunel
Nov 20, 2017 12:41
Could someone please link to the solution/ original issue.