Browse Source

#4471 Don't throw exception on IOSPlatformProvider.GetCurrentOSPlatform()

pull/4513/head
Halil İbrahim Kalkan 6 years ago
parent
commit
5f65222671
  1. 12
      framework/src/Volo.Abp.Core/System/Runtime/OSPlatformProvider.cs

12
framework/src/Volo.Abp.Core/System/Runtime/OSPlatformProvider.cs

@ -5,17 +5,11 @@ namespace System.Runtime
{ {
public class OSPlatformProvider : IOSPlatformProvider, ITransientDependency public class OSPlatformProvider : IOSPlatformProvider, ITransientDependency
{ {
public OSPlatform GetCurrentOSPlatform() public virtual OSPlatform GetCurrentOSPlatform()
{ {
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{ {
//MAC return OSPlatform.OSX; //MAC
return OSPlatform.OSX;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return OSPlatform.Linux;
} }
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@ -23,7 +17,7 @@ namespace System.Runtime
return OSPlatform.Windows; return OSPlatform.Windows;
} }
throw new Exception("Cannot determine operating system!"); return OSPlatform.Linux;
} }
} }
} }

Loading…
Cancel
Save