Esempio n. 1
0
int32_t
omrfile_mkdir(struct OMRPortLibrary *portLibrary, const char *path)
{
	wchar_t unicodeBuffer[UNICODE_BUFFER_SIZE], *unicodePath;
	int32_t result = 0;

	Trc_PRT_file_mkdir_entry2(path);
	/* Convert the filename from UTF8 to Unicode */
	unicodePath = file_get_unicode_path(portLibrary, path, unicodeBuffer, UNICODE_BUFFER_SIZE);
	if (NULL == unicodePath) {
		result = -1;
	} else {

		result = CreateDirectoryW(unicodePath, 0);
		if (unicodeBuffer != unicodePath) {
			portLibrary->mem_free_memory(portLibrary, unicodePath);
		}
		if (0 == result) {
			int32_t error = GetLastError();
			result = portLibrary->error_set_last_error(portLibrary, error, findError(error));
		} else {
			result = 0;
		}
	}
	Trc_PRT_file_mkdir_exit2(result);
	return result;
}
Esempio n. 2
0
int32_t
omrfile_mkdir(struct OMRPortLibrary *portLibrary, const char *path)
{
	int32_t rc = 0;

	Trc_PRT_file_mkdir_entry2(path);
	if (-1 == mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO)) {
		rc = portLibrary->error_set_last_error(portLibrary, errno, findError(errno));
	}
	Trc_PRT_file_mkdir_exit2(rc);
	return rc;
}