@@ -604,7 +604,7 @@ private static void FileStat(StdWString str, out Stat stat)
604
604
605
605
// Unix-based stat method
606
606
607
- [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "stat" , SetLastError = true ) ]
607
+ [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "stat" ) ]
608
608
private static extern unsafe int OSXFileStat ( byte * path , out OSXStat buf ) ;
609
609
610
610
[ StructLayout ( LayoutKind . Sequential ) ]
@@ -760,15 +760,15 @@ public bool ShouldIgnore()
760
760
}
761
761
762
762
// P/Invoke for opendir
763
- [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "opendir" , SetLastError = true ) ]
763
+ [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "opendir" ) ]
764
764
private static extern unsafe nint OSXOpenDir ( byte * name ) ;
765
765
766
766
// P/Invoke for readdir
767
- [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "readdir" , SetLastError = true ) ]
767
+ [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "readdir" ) ]
768
768
private static extern unsafe OSXDirEnt * OSXReadDir ( nint dir ) ;
769
769
770
770
// P/Invoke for closedir
771
- [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "closedir" , SetLastError = true ) ]
771
+ [ DllImport ( "libSystem.B.dylib" , CallingConvention = CallingConvention . Cdecl , EntryPoint = "closedir" ) ]
772
772
private static extern unsafe int OSXCloseDir ( nint dir ) ;
773
773
774
774
public static IEnumerable < FileMetadata > EnumerateEntriesOSX ( string path , string pattern , SearchOption option )
@@ -854,11 +854,9 @@ private static FileMetadata OSXConvert(OSXDirEnt entry, StdString path)
854
854
return meta ;
855
855
}
856
856
857
- private static void OSXFileStat ( StdWString str , out OSXStat stat )
857
+ private static int OSXFileStat ( StdWString str , out OSXStat stat )
858
858
{
859
- Console . WriteLine ( $ "OSXFileStat -> Ptr: { ( nint ) str . Data } ") ; // not null
860
859
int strSize0 = Encoding . UTF8 . GetByteCount ( str . Data , str . Size ) ;
861
- Console . WriteLine ( $ "OSXFileStat -> Ptr: { ( nint ) str . Data } ") ; // not null
862
860
byte * pStr0 ;
863
861
if ( strSize0 >= Utils . MaxStackallocSize )
864
862
{
@@ -871,14 +869,12 @@ private static void OSXFileStat(StdWString str, out OSXStat stat)
871
869
}
872
870
Encoding . UTF8 . GetBytes ( str . Data , str . Size , pStr0 , strSize0 ) ;
873
871
pStr0 [ strSize0 ] = 0 ;
874
- Console . WriteLine ( $ "OSXFileStat -> Ptr: { ( nint ) str . Data } ") ; // not null
875
- OSXFileStat ( pStr0 , out stat ) ;
876
- Console . WriteLine ( $ "OSXFileStat -> Ptr: { ( nint ) str . Data } ") ; // not null
872
+ int ret = OSXFileStat ( pStr0 , out stat ) ;
877
873
if ( strSize0 >= Utils . MaxStackallocSize )
878
874
{
879
875
Utils . Free ( pStr0 ) ;
880
876
}
881
- Console . WriteLine ( $ "OSXFileStat -> Ptr: { ( nint ) str . Data } " ) ; // not null
877
+ return ret ;
882
878
}
883
879
884
880
#endregion OSX
0 commit comments