summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/IO/Directory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/IO/Directory.cs')
-rw-r--r--src/mscorlib/src/System/IO/Directory.cs28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/mscorlib/src/System/IO/Directory.cs b/src/mscorlib/src/System/IO/Directory.cs
index 88a669a971..6417207d38 100644
--- a/src/mscorlib/src/System/IO/Directory.cs
+++ b/src/mscorlib/src/System/IO/Directory.cs
@@ -25,8 +25,8 @@ using System.Diagnostics.Contracts;
namespace System.IO
{
- internal static class Directory {
-
+ internal static class Directory
+ {
// Private class that holds search data that is passed around
// in the heap based stack recursion
internal sealed class SearchData
@@ -55,7 +55,7 @@ namespace System.IO
if (searchPattern == null)
throw new ArgumentNullException(nameof(searchPattern));
if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
- throw new ArgumentOutOfRangeException(nameof(searchOption), Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(nameof(searchOption), SR.ArgumentOutOfRange_Enum);
Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
Contract.EndContractBlock();
@@ -85,8 +85,9 @@ namespace System.IO
}
#endif // PLATFORM_UNIX
- internal static String InternalGetDirectoryRoot(String path) {
- if (path == null) return null;
+ internal static String InternalGetDirectoryRoot(String path)
+ {
+ if (path == null) return null;
return path.Substring(0, PathInternal.GetRootLength(path));
}
@@ -116,10 +117,10 @@ namespace System.IO
buffer.Length = (int)result;
-#if !PLATFORM_UNIX
+#if PLATFORM_WINDOWS
if (buffer.Contains('~'))
return Path.GetFullPath(buffer.ToString());
-#endif
+#endif // PLATFORM_WINDOWS
return buffer.ToString();
}
@@ -131,16 +132,17 @@ namespace System.IO
public static void SetCurrentDirectory(String path)
{
- if (path==null)
+ if (path == null)
throw new ArgumentNullException(nameof(path));
- if (path.Length==0)
- throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
+ if (path.Length == 0)
+ throw new ArgumentException(SR.Argument_PathEmpty);
if (path.Length >= Path.MaxPath)
- throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+ throw new PathTooLongException(SR.IO_PathTooLong);
String fulldestDirName = Path.GetFullPath(path);
-
- if (!Win32Native.SetCurrentDirectory(fulldestDirName)) {
+
+ if (!Win32Native.SetCurrentDirectory(fulldestDirName))
+ {
// If path doesn't exist, this sets last error to 2 (File
// not Found). LEGACY: This may potentially have worked correctly
// on Win9x, maybe.