File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
Common/src/Interop/Unix/System.Native
System.Private.CoreLib/src/System/IO Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,8 @@ internal static partial class Sys
1414
1515 internal static int MkDir ( ReadOnlySpan < char > path , int mode )
1616 {
17- var converter = new ValueUtf8Converter ( stackalloc byte [ DefaultPathBufferSize ] ) ;
17+ using ValueUtf8Converter converter = new ( stackalloc byte [ DefaultPathBufferSize ] ) ;
1818 int result = MkDir ( ref MemoryMarshal . GetReference ( converter . ConvertAndTerminateString ( path ) ) , mode ) ;
19- converter . Dispose ( ) ;
2019 return result ;
2120 }
2221 }
Original file line number Diff line number Diff line change @@ -300,26 +300,19 @@ public static void CreateDirectory(string fullPath)
300300 }
301301 else if ( errorInfo . Error == Interop . Error . ENOENT ) // Some parts of the path don't exist yet.
302302 {
303- // Try create parents bottom to top and track those that could not
304- // be created due to missing parents. Then create them top to bottom.
305- ValueListBuilder < int > stackDir = new ( stackalloc int [ 32 ] ) ; // 32 arbitrarily chosen
306- try
307- {
308- CreateParentsAndDirectory ( fullPath , ref stackDir ) ;
309- }
310- finally
311- {
312- stackDir . Dispose ( ) ;
313- }
303+ CreateParentsAndDirectory ( fullPath ) ;
314304 }
315305 else
316306 {
317307 throw Interop . GetExceptionForIoErrno ( errorInfo , fullPath , isDirectory : true ) ;
318308 }
319309 }
320310
321- private static void CreateParentsAndDirectory ( string fullPath , ref ValueListBuilder < int > stackDir )
311+ private static void CreateParentsAndDirectory ( string fullPath )
322312 {
313+ // Try create parents bottom to top and track those that could not
314+ // be created due to missing parents. Then create them top to bottom.
315+ using ValueListBuilder < int > stackDir = new ( stackalloc int [ 32 ] ) ; // 32 arbitrarily chosen
323316 stackDir . Append ( fullPath . Length ) ;
324317
325318 int i = fullPath . Length - 1 ;
You can’t perform that action at this time.
0 commit comments