Пример #1
0
int32_t
omrfile_findnext(struct OMRPortLibrary *portLibrary, uintptr_t findhandle, char *resultbuf)
{
	WIN32_FIND_DATAW findFileData;
	Trc_PRT_file_findnext_Entry2(findhandle, resultbuf);
	if (!FindNextFileW((HANDLE)findhandle, &findFileData)) {
		int32_t error = GetLastError();
		error = portLibrary->error_set_last_error(portLibrary, error, findError(error));
		Trc_PRT_file_findnext_ExitFail(error);
		return -1;
	}

	/* Assume a successful conversion. The data may be truncated to fit. */
	port_convertToUTF8(portLibrary, findFileData.cFileName, resultbuf, EsMaxPath);
	Trc_PRT_file_findnext_Exit(0);
	return 0;
}
Пример #2
0
/**
 * Find the next filename and path matching a given handle.
 *
 * @param[in] portLibrary The port library
 * @param[in] findhandle handle returned from @ref omrfile_findfirst.
 * @param[out] resultbuf next filename and path matching findhandle.
 *
 * @return 0 on success, -1 on failure or if no matching entries.
 * @internal @todo return negative portable return code on failure.
 */
int32_t
omrfile_findnext(struct OMRPortLibrary *portLibrary, uintptr_t findhandle, char *resultbuf)
{
#if defined(AIXPPC)
	struct dirent64 *entry;
#else
	struct dirent *entry;
#endif

	Trc_PRT_file_findnext_Entry2(findhandle, resultbuf);

#if defined(AIXPPC)
	entry = readdir64((DIR64 *)findhandle);
#else
	entry = readdir((DIR *)findhandle);
#endif
	if (entry == NULL) {
		Trc_PRT_file_findnext_ExitFail(-1);
		return -1;
	}
	strcpy(resultbuf, entry->d_name);
	Trc_PRT_file_findnext_Exit(0);
	return 0;
}