@@ -229,32 +229,32 @@ public async Task ExtractFiles(IEnumerable<(Hash Hash, AbsolutePath Dest)> files
229229// Capacity is set to 'expected archive count' + 1.
230230Parallel . ForEach ( files , file=>
231231{
232+ // Create the directory, this will speed up extraction in Nx
233+ // down the road. Usually the difference is negligible, but in
234+ // extra special with 100s of directories scenarios, it can
235+ // save a second or two.
236+ var containingDir = file . Dest . Parent ;
237+ if ( createdDirectories . TryAdd ( containingDir , 0 ) )
238+ containingDir . CreateDirectory ( ) ;
239+
240+ #ifDEBUG
241+ Debug . Assert ( destPaths . TryAdd ( file . Dest , 0 ) , $ "Duplicate destination path:{ file . Dest } . Should not happen.") ;
242+ #endif
243+
232244// Create empty files as empty
233245if ( file . Hash == EmptyFile )
234246{
235247file . Dest . Create ( ) . Dispose ( ) ;
236248return ;
237249}
238250
239- if ( TryGetLocation ( file . Hash ,
240- out var archivePath , out var fileEntry ) )
251+ if ( TryGetLocation ( file . Hash , out var archivePath , out var fileEntry ) )
241252{
242253var group = groupedFiles . GetOrAdd ( archivePath , _=> new List < ( Hash , FileEntry , AbsolutePath ) > ( ) ) ;
243254lock ( group )
244255{
245256group . Add ( ( file . Hash , fileEntry , file . Dest ) ) ;
246257}
247-
248- // Create the directory, this will speed up extraction in Nx
249- // down the road. Usually the difference is negligible, but in
250- // extra special with 100s of directories scenarios, it can
251- // save a second or two.
252- var containingDir = file . Dest . Parent ;
253- if ( createdDirectories . TryAdd ( containingDir , 0 ) )
254- containingDir . CreateDirectory ( ) ;
255- #ifDEBUG
256- Debug . Assert ( destPaths . TryAdd ( file . Dest , 0 ) , $ "Duplicate destination path:{ file . Dest } . Should not happen.") ;
257- #endif
258258}
259259else
260260{