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

◆ NormalizeDriveName() [2/2]

static string System.IO.DriveInfoInternal.NormalizeDriveName ( string driveName)
inlinestatic

Definition at line 38 of file DriveInfoInternal.cs.

39 {
40 string text;
41 if (driveName.Length == 1)
42 {
43 text = driveName + ":\\";
44 }
45 else
46 {
47 text = Path.GetPathRoot(driveName);
48 if (string.IsNullOrEmpty(text) || text.StartsWith("\\\\", StringComparison.Ordinal))
49 {
50 throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir, "driveName");
51 }
52 }
53 if (text.Length == 2 && text[1] == ':')
54 {
55 text += "\\";
56 }
57 char c = driveName[0];
58 if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z'))
59 {
60 throw new ArgumentException(SR.Arg_MustBeDriveLetterOrRootDir, "driveName");
61 }
62 return text;
63 }

References System.SR.Arg_MustBeDriveLetterOrRootDir, System.IO.Path.GetPathRoot(), and System.text.