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)
143
143
}
144
144
}
145
145
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
+
146
161
public static DependencyContainer GetCompilationDependencies ( ProgressMonitor progressMonitor , IEnumerable < string > assets )
147
162
{
148
163
var parser = new Assets ( progressMonitor ) ;
149
164
var dependencies = new DependencyContainer ( ) ;
150
165
assets . ForEach ( asset =>
151
166
{
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
+ }
154
171
} ) ;
155
172
return dependencies ;
156
173
}
You can’t perform that action at this time.
0 commit comments