Skip to content

Commit 0afbe00

Browse files
committed
Another try.
1 parent c88fd30 commit 0afbe00

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Hexa.NET.ImGui.Widgets/Dialogs/FileUtilities.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ private static void FileStat(StdWString str, out Stat stat)
604604

605605
// Unix-based stat method
606606

607-
[DllImport("libSystem.B.dylib", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stat", SetLastError = true)]
607+
[DllImport("libSystem.B.dylib", CallingConvention = CallingConvention.Cdecl, EntryPoint = "stat")]
608608
private static extern unsafe int OSXFileStat(byte* path, out OSXStat buf);
609609

610610
[StructLayout(LayoutKind.Sequential)]
@@ -760,15 +760,15 @@ public bool ShouldIgnore()
760760
}
761761

762762
// 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")]
764764
private static extern unsafe nint OSXOpenDir(byte* name);
765765

766766
// 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")]
768768
private static extern unsafe OSXDirEnt* OSXReadDir(nint dir);
769769

770770
// 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")]
772772
private static extern unsafe int OSXCloseDir(nint dir);
773773

774774
public static IEnumerable<FileMetadata> EnumerateEntriesOSX(string path, string pattern, SearchOption option)
@@ -854,11 +854,9 @@ private static FileMetadata OSXConvert(OSXDirEnt entry, StdString path)
854854
return meta;
855855
}
856856

857-
private static void OSXFileStat(StdWString str, out OSXStat stat)
857+
private static int OSXFileStat(StdWString str, out OSXStat stat)
858858
{
859-
Console.WriteLine($"OSXFileStat -> Ptr: {(nint)str.Data}"); // not null
860859
int strSize0 = Encoding.UTF8.GetByteCount(str.Data, str.Size);
861-
Console.WriteLine($"OSXFileStat -> Ptr: {(nint)str.Data}"); // not null
862860
byte* pStr0;
863861
if (strSize0 >= Utils.MaxStackallocSize)
864862
{
@@ -871,14 +869,12 @@ private static void OSXFileStat(StdWString str, out OSXStat stat)
871869
}
872870
Encoding.UTF8.GetBytes(str.Data, str.Size, pStr0, strSize0);
873871
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);
877873
if (strSize0 >= Utils.MaxStackallocSize)
878874
{
879875
Utils.Free(pStr0);
880876
}
881-
Console.WriteLine($"OSXFileStat -> Ptr: {(nint)str.Data}"); // not null
877+
return ret;
882878
}
883879

884880
#endregion OSX

0 commit comments

Comments
 (0)