diff --git a/src/MfGames.IO/Extensions/DirectoryInfoExtensions.cs b/src/MfGames.IO/Extensions/DirectoryInfoExtensions.cs index df53189..ae5cbe9 100644 --- a/src/MfGames.IO/Extensions/DirectoryInfoExtensions.cs +++ b/src/MfGames.IO/Extensions/DirectoryInfoExtensions.cs @@ -29,7 +29,7 @@ namespace MfGames.IO.Extensions directory.Parent.CreateIfMissing(); // If the directory doesn't exist, create it. - if (!directory.Exists) + if (!Directory.Exists(directory.FullName)) { directory.Create(); } @@ -84,8 +84,9 @@ namespace MfGames.IO.Extensions } // If the directory is null, just return null. Same with - // non-existing directories. - if (directory is not { Exists: true }) + // non-existing directories. We don't use directory.Exists here + // because it seems to be cached and we get incorrect data. + if (directory == null || !File.Exists(directory.FullName)) { return null; }