* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2012 Xamarin Inc (http://www.xamarin.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
}
MonoString *
-ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error)
+ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *io_error)
{
+ MonoError error;
MonoString *result;
gunichar2 *buf;
int len, res_len;
len = MAX_PATH + 1; /*FIXME this is too smal under most unix systems.*/
buf = g_new (gunichar2, len);
- *error=ERROR_SUCCESS;
+ mono_error_init (&error);
+ *io_error=ERROR_SUCCESS;
result = NULL;
res_len = GetCurrentDirectory (len, buf);
while (buf [len])
++ len;
- result = mono_string_new_utf16 (mono_domain_get (), buf, len);
+ result = mono_string_new_utf16_checked (mono_domain_get (), buf, len, &error);
} else {
- *error=GetLastError ();
+ *io_error=GetLastError ();
}
g_free (buf);
+ mono_error_raise_exception (&error);
return result;
}
offset_hi = offset >> 32;
offset = SetFilePointer (handle, (gint32) (offset & 0xFFFFFFFF), &offset_hi,
- (WapiSeekMethod)convert_seekorigin ((MonoSeekOrigin)origin));
+ convert_seekorigin ((MonoSeekOrigin)origin));
if(offset==INVALID_SET_FILE_POINTER) {
*error=GetLastError ();