added rmdir()
This commit is contained in:
parent
fe971497cc
commit
deccf7816c
|
@ -774,6 +774,21 @@ static cell AMX_NATIVE_CALL amx_ungetc(AMX *amx, cell *params)
|
||||||
return ungetc(static_cast<int>(params[2]), fp);
|
return ungetc(static_cast<int>(params[2]), fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined __linux__
|
||||||
|
#define _rmdir rmdir
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL amx_rmdir(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char* sFile = build_pathname("%s", get_amxstring(amx, params[1], 0, len));
|
||||||
|
|
||||||
|
if (_rmdir(sFile) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO file_Natives[] =
|
AMX_NATIVE_INFO file_Natives[] =
|
||||||
{
|
{
|
||||||
{"delete_file", delete_file},
|
{"delete_file", delete_file},
|
||||||
|
@ -806,5 +821,6 @@ AMX_NATIVE_INFO file_Natives[] =
|
||||||
{"fgetc", amx_fgetc},
|
{"fgetc", amx_fgetc},
|
||||||
{"fputc", amx_fputc},
|
{"fputc", amx_fputc},
|
||||||
{"fungetc", amx_ungetc},
|
{"fungetc", amx_ungetc},
|
||||||
|
{"rmdir", amx_rmdir},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,6 +89,11 @@ native fungetc(file, data);
|
||||||
//Return the size of a file
|
//Return the size of a file
|
||||||
native filesize(const filename[],{Float,Sql,Result,_}:...);
|
native filesize(const filename[],{Float,Sql,Result,_}:...);
|
||||||
|
|
||||||
|
//Attempts to remove a directory.
|
||||||
|
//Note that you cannot remove a directory that has files on most
|
||||||
|
// operating systems.
|
||||||
|
native rmdir(const path[]);
|
||||||
|
|
||||||
//Delete a file (delete_file macro)
|
//Delete a file (delete_file macro)
|
||||||
native unlink(const filename[],{Float,Sql,Result,_}:...);
|
native unlink(const filename[],{Float,Sql,Result,_}:...);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user