File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -143,14 +143,31 @@ public bool TryParse(string json, DependencyContainer dependencies)
143143 }
144144 }
145145
146+ private static bool TryReadAllText ( string path , ProgressMonitor progressMonitor , out string content )
147+ {
148+ try
149+ {
150+ content = File . ReadAllText ( path ) ;
151+ return true ;
152+ }
153+ catch ( Exception e )
154+ {
155+ progressMonitor . LogInfo ( $ "Failed to read assets file '{ path } ': { e . Message } ") ;
156+ content = "" ;
157+ return false ;
158+ }
159+ }
160+
146161 public static DependencyContainer GetCompilationDependencies ( ProgressMonitor progressMonitor , IEnumerable < string > assets )
147162 {
148163 var parser = new Assets ( progressMonitor ) ;
149164 var dependencies = new DependencyContainer ( ) ;
150165 assets . ForEach ( asset =>
151166 {
152- var json = File . ReadAllText ( asset ) ;
153- parser . TryParse ( json , dependencies ) ;
167+ if ( TryReadAllText ( asset , progressMonitor , out var json ) )
168+ {
169+ parser . TryParse ( json , dependencies ) ;
170+ }
154171 } ) ;
155172 return dependencies ;
156173 }
You can’t perform that action at this time.
0 commit comments