fix: handle directory.Exists caching
This commit is contained in:
parent
b95c6b4bf5
commit
233656abb9
|
@ -29,7 +29,7 @@ namespace MfGames.IO.Extensions
|
||||||
directory.Parent.CreateIfMissing();
|
directory.Parent.CreateIfMissing();
|
||||||
|
|
||||||
// If the directory doesn't exist, create it.
|
// If the directory doesn't exist, create it.
|
||||||
if (!directory.Exists)
|
if (!Directory.Exists(directory.FullName))
|
||||||
{
|
{
|
||||||
directory.Create();
|
directory.Create();
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,9 @@ namespace MfGames.IO.Extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the directory is null, just return null. Same with
|
// If the directory is null, just return null. Same with
|
||||||
// non-existing directories.
|
// non-existing directories. We don't use directory.Exists here
|
||||||
if (directory is not { Exists: true })
|
// because it seems to be cached and we get incorrect data.
|
||||||
|
if (directory == null || !File.Exists(directory.FullName))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue