Skip to content

Commit

Permalink
adds build required OSPlatform calls (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebozduman authored Dec 2, 2023
1 parent 313638a commit 1d82ddc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions FileUploader/FileUpload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

using System.Net;
using System.Runtime.InteropServices;
using Minio;
using Minio.DataModel.Args;

Expand All @@ -32,7 +31,7 @@ public static class FileUpload
{
private static bool IsWindows()
{
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
return OperatingSystem.IsWindows();
}

private static async Task Main(string[] args)
Expand Down
3 changes: 1 addition & 2 deletions Minio.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using Minio.DataModel;
Expand Down Expand Up @@ -282,6 +281,6 @@ await SetBucketReplication.Run(minioClient, bucketName, destBucketName, replicat
File.Delete(smallFileName);
File.Delete(bigFileName);

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) _ = Console.ReadLine();
if (OperatingSystem.IsWindows()) _ = Console.ReadLine();
}
}
8 changes: 5 additions & 3 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -4821,7 +4820,10 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio)
#else
await File.WriteAllLinesAsync(tempSource, line).ConfigureAwait(false);
#endif
using (var filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read))
FileStream filestream = null;
await
using ((filestream = File.Open(tempSource, FileMode.Open, FileAccess.Read, FileShare.Read))
.ConfigureAwait(false))
{
var objectSize = (int)filestream.Length;
var expectedFileSize = lengthToBeRead;
Expand All @@ -4830,7 +4832,7 @@ internal static async Task GetObject_3_OffsetLength_Tests(IMinioClient minio)
{
expectedFileSize = objectSize - offsetToStartFrom;
var noOfCtrlChars = 1;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) noOfCtrlChars = 2;
if (OperatingSystem.IsWindows()) noOfCtrlChars = 2;

expectedContent = string.Concat(line)
.Substring(offsetToStartFrom, expectedFileSize - noOfCtrlChars);
Expand Down

0 comments on commit 1d82ddc

Please sign in to comment.