Merge pull request #315 from alliedmodders/direxists-empty

Make DirExists("") throw an error.
This commit is contained in:
Nicholas Hastings 2015-04-01 22:30:03 -04:00
commit ce56680fff

View File

@ -309,7 +309,7 @@ static cell_t sm_OpenDirectory(IPluginContext *pContext, const cell_t *params)
if (!path[0]) if (!path[0])
{ {
return pContext->ThrowNativeError("Invalid file path"); return pContext->ThrowNativeError("Invalid path. An empty path string is not valid, use \".\" to refer to the current working directory.");
} }
Handle_t handle = 0; Handle_t handle = 0;
@ -617,6 +617,11 @@ static cell_t sm_DirExists(IPluginContext *pContext, const cell_t *params)
char *name; char *name;
pContext->LocalToString(params[1], &name); pContext->LocalToString(params[1], &name);
if (!name[0])
{
return pContext->ThrowNativeError("Invalid path. An empty path string is not valid, use \".\" to refer to the current working directory.");
}
if (params[0] >= 2 && params[2] == 1) if (params[0] >= 2 && params[2] == 1)
{ {
char *pathID; char *pathID;