blob: f2ffeee6e8c3595ce3ed158a95fe0fd61a968029 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/**
* \file os_rmdir.c
* \brief Remove a subdirectory.
* \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
*/
#include <stdlib.h>
#include "premake.h"
int os_rmdir(lua_State* L)
{
int z;
const char* path = luaL_checkstring(L, 1);
#if PLATFORM_WINDOWS
z = RemoveDirectory(path);
#else
z = (0 == rmdir(path));
#endif
if (!z)
{
lua_pushnil(L);
lua_pushfstring(L, "unable to remove directory '%s'", path);
return 2;
}
else
{
lua_pushboolean(L, 1);
return 1;
}
}
|