read_dir for msvc compiler
This commit is contained in:
parent
6645e5d4aa
commit
76915facd3
|
@ -70,8 +70,31 @@ static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
|
|||
closedir (dp);
|
||||
return a;
|
||||
#else
|
||||
int tmp;
|
||||
char *dirname = build_pathname("%s/*", get_amxstring(amx, params[1], 0, tmp));
|
||||
tmp = params[2];
|
||||
|
||||
_finddata_t fd;
|
||||
intptr_t handle = _findfirst(dirname, &fd);
|
||||
if (handle < 0)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
++tmp;
|
||||
for (int i = 0; i < tmp; ++i)
|
||||
{
|
||||
if (_findnext(handle, &fd) < 0)
|
||||
{
|
||||
tmp = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// current data in fd
|
||||
cell *length = get_amxaddr(amx,params[5]); // pointer to the outLen parameter
|
||||
*length = set_amxstring(amx, params[3], fd.name, params[4]); // set output and outLen parameters
|
||||
_findclose(handle);
|
||||
|
||||
return tmp;
|
||||
#endif // __GNUC__
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL read_file(AMX *amx, cell *params) /* 5 param */
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user