diff --git a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs b/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs index b91936824fbc36..99f9c98a30e9d5 100644 --- a/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs +++ b/src/libraries/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs @@ -361,19 +361,6 @@ public static void MoveDirectory(string sourceFullPath, string destFullPath) throw new IOException(SR.Format(SR.IO_AlreadyExists_Name, destFullPath)); } -#if TARGET_BROWSER - // renaming a file doesn't return correct error code on emscripten if one of the parent paths does not exist, - // manually workaround it for now (https://github.com/dotnet/runtime/issues/40305) - if (!Directory.Exists(Path.GetDirectoryName(sourceFullPath))) - { - throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, sourceFullPath)); - } - if (!Directory.Exists(Path.GetDirectoryName(destFullPath))) - { - throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, destFullPath)); - } -#endif - if (Interop.Sys.Rename(sourceFullPath, destFullPath) < 0) { Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();