Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateSubdirectory()

DirectoryInfo System.IO.DirectoryInfo.CreateSubdirectory ( string path)
inline

Definition at line 45 of file DirectoryInfo.cs.

46 {
47 if (path == null)
48 {
49 throw new ArgumentNullException("path");
50 }
51 if (PathInternal.IsEffectivelyEmpty(path.AsSpan()))
52 {
53 throw new ArgumentException(SR.Argument_PathEmpty, "path");
54 }
55 if (Path.IsPathRooted(path))
56 {
57 throw new ArgumentException(SR.Arg_Path2IsRooted, "path");
58 }
59 string fullPath = Path.GetFullPath(Path.Combine(FullPath, path));
60 ReadOnlySpan<char> span = Path.TrimEndingDirectorySeparator(fullPath.AsSpan());
61 ReadOnlySpan<char> value = Path.TrimEndingDirectorySeparator(FullPath.AsSpan());
62 if (span.StartsWith(value, PathInternal.StringComparison) && (span.Length == value.Length || PathInternal.IsDirectorySeparator(fullPath[value.Length])))
63 {
64 FileSystem.CreateDirectory(fullPath);
65 return new DirectoryInfo(fullPath);
66 }
67 throw new ArgumentException(SR.Format(SR.Argument_InvalidSubPath, path, FullPath), "path");
68 }

References System.IO.DirectoryInfo.DirectoryInfo(), System.SR.Arg_Path2IsRooted, System.SR.Argument_InvalidSubPath, System.SR.Argument_PathEmpty, System.IO.Path.Combine(), System.IO.FileSystem.CreateDirectory(), System.SR.Format(), System.IO.FileSystemInfo.FullPath, System.IO.Path.GetFullPath(), System.IO.PathInternal.IsDirectorySeparator(), System.IO.PathInternal.IsEffectivelyEmpty(), System.IO.Path.IsPathRooted(), System.IO.PathInternal.StringComparison, System.IO.Path.TrimEndingDirectorySeparator(), and System.value.