From fb6cc280611ec76fefd55b2f50c563e0fc6aa45c Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Thu, 30 Jul 2020 23:09:44 +0200 Subject: [PATCH] Exclude EUid and EGid for Browser build as they are not supported (#39483) --- .../System.IO.FileSystem/src/System.IO.FileSystem.csproj | 13 +++++++++---- .../System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj index 0c36fbf..f7d2d0c 100644 --- a/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj +++ b/src/libraries/System.IO.FileSystem/src/System.IO.FileSystem.csproj @@ -5,6 +5,9 @@ $(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser enable + + $(DefineConstants);TARGET_BROWSER + @@ -177,8 +180,6 @@ Link="Interop\Unix\Interop.Errors.cs" /> - - + + + + diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs index 086c090..e32d3a1 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs +++ b/src/libraries/System.IO.FileSystem/src/System/IO/FileStatus.Unix.cs @@ -39,7 +39,12 @@ namespace System.IO internal bool IsReadOnly(ReadOnlySpan path, bool continueOnError = false) { EnsureStatInitialized(path, continueOnError); +#if TARGET_BROWSER + const Interop.Sys.Permissions readBit = Interop.Sys.Permissions.S_IRUSR; + const Interop.Sys.Permissions writeBit = Interop.Sys.Permissions.S_IWUSR; +#else Interop.Sys.Permissions readBit, writeBit; + if (_fileStatus.Uid == Interop.Sys.GetEUid()) { // User effectively owns the file @@ -58,6 +63,7 @@ namespace System.IO readBit = Interop.Sys.Permissions.S_IROTH; writeBit = Interop.Sys.Permissions.S_IWOTH; } +#endif return ((_fileStatus.Mode & (int)readBit) != 0 && // has read permission (_fileStatus.Mode & (int)writeBit) == 0); // but not write permission -- 2.7.4