fix: handle directory.Exists caching
This commit is contained in:
parent
b95c6b4bf5
commit
233656abb9
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Reference in a new issue