1 /** 2 * \file path_isabsolute.c 3 * \brief Determines if a path is absolute or relative. 4 * \author Copyright (c) 2002-2009 Jason Perkins and the Premake project 5 */ 6 7 #include "premake.h" 8 9 path_isabsolute(lua_State * L)10int path_isabsolute(lua_State* L) 11 { 12 const char* path = luaL_checkstring(L, 1); 13 if (path[0] == '/' || path[0] == '\\' || path[0] == '$' || (path[0] != '\0' && path[1] == ':')) 14 { 15 lua_pushboolean(L, 1); 16 return 1; 17 } 18 else 19 { 20 return 0; 21 } 22 } 23