+2009-11-23 Miguel de Icaza <miguel@novell.com>
+
+ * file-io.c: Change FindFirst/FindNext/FindClose API to return the
+ file attribute to managed code and avoid doing the mask/attribute
+ checks here.
+
2009-11-22 Miguel de Icaza <miguel@novell.com>
* file-io.c: Surface a smart FindFirst/FindNext/FindClose API to
typedef struct {
MonoDomain *domain;
- gint attrs, mask;
gchar *utf8_path;
HANDLE find_handle;
} IncrementalFind;
if ((data->cFileName[0] == '.' && data->cFileName[1] == 0) || (data->cFileName[0] == '.' && data->cFileName[1] == '.' && data->cFileName[2] == 0))
return FALSE;
- if ((data->dwFileAttributes & handle->mask) != handle->attrs)
- return FALSE;
-
utf8_result = g_utf16_to_utf8 (data->cFileName, -1, NULL, NULL, NULL);
if (utf8_result == NULL)
return FALSE;
MonoString *
ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
MonoString *path_with_pattern,
- gint attrs, gint mask,
- gint32 *error,
+ gint32 *result_attr, gint32 *error,
gpointer *handle)
{
WIN32_FIND_DATA data;
MonoString *result;
*error = ERROR_SUCCESS;
- mask = convert_attrs (mask);
find_handle = FindFirstFile (mono_string_chars (path_with_pattern), &data);
ifh = g_new (IncrementalFind, 1);
ifh->find_handle = find_handle;
- ifh->mask = mask;
- ifh->attrs = attrs;
ifh->utf8_path = mono_string_to_utf8 (path);
ifh->domain = mono_domain_get ();
*handle = ifh;
return NULL;
}
}
-
+ *result_attr = data.dwFileAttributes;
+
return result;
}
MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *error)
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_attr, gint32 *error)
{
IncrementalFind *ifh = handle;
WIN32_FIND_DATA data;
}
} while (incremental_find_check_match (ifh, &data, &result) == 0);
+ *result_attr = data.dwFileAttributes;
return result;
}
extern MonoString *
ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
MonoString *path_with_pattern,
- gint attrs, gint mask,
+ gint32 *result_mask,
gint32 *error,
gpointer *handle) MONO_INTERNAL;
extern MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error) MONO_INTERNAL;
extern int
ves_icall_System_IO_MonoIO_FindClose (gpointer handle) MONO_INTERNAL;