if (File.Exists(path))
throw new IOException ("Cannot create " + path + " because a file with the same name already exists.");
- // LAMESPEC: with .net 1.0 version this throw NotSupportedException and msdn says so too
- // but v1.1 throws ArgumentException.
if (Environment.IsRunningOnWindows && path == ":")
throw new ArgumentException ("Only ':' In path");
info.Parent.Create ();
MonoIOError error;
- if (!MonoIO.CreateDirectory (path, out error)) {
+ if (!MonoIO.CreateDirectory (info.FullName, out error)) {
// LAMESPEC: 1.1 and 1.2alpha allow CreateDirectory on a file path.
// So CreateDirectory ("/tmp/somefile") will succeed if 'somefile' is
// not a directory. However, 1.0 will throw an exception.
if (!success) {
/*
* FIXME:
- * In io-layer/io.c rmdir returns error_file_not_found if directory does not exists.
+ * In io-layer/io.c rmdir returns error_file_not_found if directory does not exist.
* So maybe this could be handled somewhere else?
*/
if (error == MonoIOError.ERROR_FILE_NOT_FOUND) {
return result;
}
-#if NET_4_0
public static string[] GetFileSystemEntries (string path, string searchPattern, SearchOption searchOption)
{
// Take the simple way home:
IntPtr handle;
MonoIOError error;
FileAttributes rattr;
-
string s = MonoIO.FindFirst (path, path_with_pattern, out rattr, out error, out handle);
try {
while (s != null) {
if (((rattr & FileAttributes.Directory) == 0) && rattr != 0)
rattr |= FileAttributes.Normal;
- if ((rattr & FileAttributes.ReparsePoint) == 0 && (rattr & kind) != 0)
+ if ((rattr & kind) != 0)
yield return s;
s = MonoIO.FindNext (handle, out rattr, out error);
try {
while (s != null) {
- if ((rattr & FileAttributes.Directory) != 0)
+ if ((rattr & FileAttributes.Directory) != 0 && (rattr & FileAttributes.ReparsePoint) == 0)
foreach (string child in EnumerateKind (s, searchPattern, searchOption, kind))
yield return child;
s = MonoIO.FindNext (handle, out rattr, out error);
return EnumerateKind (path, "*", SearchOption.TopDirectoryOnly, FileAttributes.Normal | FileAttributes.Directory);
}
-#endif
public static DirectorySecurity GetAccessControl (string path, AccessControlSections includeSections)
{