Merge pull request #484 from er2off/master

Add FreeBSD support
pull/515/head
Pavel Djundik 1 year ago committed by GitHub
commit f00ef83029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -34,6 +34,12 @@ namespace DepotDownloader
[FieldOffset(4)] public readonly ushort st_mode;
}
[StructLayout(LayoutKind.Explicit, Size = 224)]
private readonly struct StatFBSDX64
{
[FieldOffset(24)] public readonly ushort st_mode;
}
[DllImport("libc", EntryPoint = "__xstat", SetLastError = true)]
private static extern int statLinuxX64(int version, string path, out StatLinuxX64 statLinux);
@ -49,6 +55,9 @@ namespace DepotDownloader
[DllImport("libc", EntryPoint = "stat$INODE64", SetLastError = true)]
private static extern int statOSXCompat(string path, out StatOSX stat);
[DllImport("libc", EntryPoint = "stat", SetLastError = true)]
private static extern int statFBSDX64(string path, out StatFBSDX64 stat);
[DllImport("libc", SetLastError = true)]
private static extern int chmod(string path, uint mode);
@ -87,6 +96,17 @@ namespace DepotDownloader
}
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
{
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.X64:
{
ThrowIf(statFBSDX64(path, out var stat));
return stat.st_mode;
}
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
switch (RuntimeInformation.ProcessArchitecture)

@ -28,6 +28,12 @@ namespace DepotDownloader
return "linux";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
{
// Return linux as freebsd steam client doesn't exist yet
return "linux";
}
return "unknown";
}

Loading…
Cancel
Save