Welcome to mirror list, hosted at ThFree Co, Russian Federation.

path_isabsolute.c « host « src - github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 961ed77f03c2a0b5498b7c742c67c3dfa46d78ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * \file   path_isabsolute.c
 * \brief  Determines if a path is absolute or relative.
 * \author Copyright (c) 2002-2009 Jason Perkins and the Premake project
 */

#include "premake.h"


int path_isabsolute(lua_State* L)
{
	const char* path = luaL_checkstring(L, -1);
	if (path[0] == '/' || path[0] == '\\' || path[0] == '$' || (path[0] != '\0' && path[1] == ':')) 
	{
		lua_pushboolean(L, 1);
		return 1;
	} 
	else 
	{
		return 0;
	}
}