diff options
author | IronClawTrem <louie.nutman@gmail.com> | 2020-02-16 03:40:06 +0000 |
---|---|---|
committer | IronClawTrem <louie.nutman@gmail.com> | 2020-02-16 03:40:06 +0000 |
commit | 425decdf7e9284d15aa726e3ae96b9942fb0e3ea (patch) | |
tree | 6c0dd7edfefff1be7b9e75fe0b3a0a85fe1595f3 /src/granger/src/premake/os_mkdir.c | |
parent | ccb0b2e4d6674a7a00c9bf491f08fc73b6898c54 (diff) |
create tremded branch
Diffstat (limited to 'src/granger/src/premake/os_mkdir.c')
-rw-r--r-- | src/granger/src/premake/os_mkdir.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/granger/src/premake/os_mkdir.c b/src/granger/src/premake/os_mkdir.c new file mode 100644 index 0000000..a7a69db --- /dev/null +++ b/src/granger/src/premake/os_mkdir.c @@ -0,0 +1,33 @@ +/** + * \file os_mkdir.c + * \brief Create a subdirectory. + * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project + */ + +#include <sys/stat.h> +#include "premake.h" + + +int os_mkdir(lua_State* L) +{ + int z; + const char* path = luaL_checkstring(L, 1); + +#if PLATFORM_WINDOWS + z = CreateDirectory(path, NULL); +#else + z = (mkdir(path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0); +#endif + + if (!z) + { + lua_pushnil(L); + lua_pushfstring(L, "unable to create directory '%s'", path); + return 2; + } + else + { + lua_pushboolean(L, 1); + return 1; + } +} |