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 0c36fbf8b216e..f7d2d0c5499a7 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 086c09039f02e..e32d3a1c54dfd 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 @@ internal static void Initialize(
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 @@ internal bool IsReadOnly(ReadOnlySpan path, bool continueOnError = false)
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