Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Baulig <mabaul@microsoft.com>2019-12-27 22:45:46 +0300
committerGitHub <noreply@github.com>2019-12-27 22:45:46 +0300
commitbff1d77e7eeb929345fa0373e5d67b6e3f5be092 (patch)
tree0e7d4284d531905f07184bd68eed995274efeb6f
parentcfbc19d80fe8bc9cf174dbeec7a11bc1b3ccc18b (diff)
parentafff76422417d0cfefca10ed0e262694aaf9d9e9 (diff)
Merge pull request #388 from steveisok/backport-dir-create-invalidate
Invalidate DirectoryInfo After Create
-rw-r--r--src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs6
-rw-r--r--src/System.IO.FileSystem/tests/DirectoryInfo/Create.cs9
2 files changed, 14 insertions, 1 deletions
diff --git a/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs b/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
index 0a388e8eae..7cac1d04fb 100644
--- a/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
+++ b/src/System.IO.FileSystem/src/System/IO/DirectoryInfo.cs
@@ -82,7 +82,11 @@ namespace System.IO
throw new ArgumentException(SR.Format(SR.Argument_InvalidSubPath, path, FullPath), nameof(path));
}
- public void Create() => FileSystem.CreateDirectory(FullPath);
+ public void Create()
+ {
+ FileSystem.CreateDirectory(FullPath);
+ Invalidate();
+ }
// Returns an array of Files in the DirectoryInfo specified by path
public FileInfo[] GetFiles() => GetFiles("*", enumerationOptions: EnumerationOptions.Compatible);
diff --git a/src/System.IO.FileSystem/tests/DirectoryInfo/Create.cs b/src/System.IO.FileSystem/tests/DirectoryInfo/Create.cs
index 45c2a637d0..56425d8ee2 100644
--- a/src/System.IO.FileSystem/tests/DirectoryInfo/Create.cs
+++ b/src/System.IO.FileSystem/tests/DirectoryInfo/Create.cs
@@ -74,5 +74,14 @@ namespace System.IO.Tests
DirectoryInfo testInfo = new DirectoryInfo(testDir + extension + trailing);
Assert.Equal(trailing, testInfo.Extension);
}
+
+ [Fact]
+ public void CreateDirectoryWithAttributes()
+ {
+ string testDir = Path.Combine(GetTestFilePath(), "CreateDirectoryWithAttributes");
+ DirectoryInfo testInfo = new DirectoryInfo(testDir);
+ testInfo.Create();
+ testInfo.Attributes = FileAttributes.Directory | FileAttributes.Normal;
+ }
}
}