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

github.com/windirstat/premake-4.x.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/path_isabsolute.c')
-rw-r--r--src/host/path_isabsolute.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/host/path_isabsolute.c b/src/host/path_isabsolute.c
index 961ed77..7412935 100644
--- a/src/host/path_isabsolute.c
+++ b/src/host/path_isabsolute.c
@@ -1,7 +1,7 @@
/**
* \file path_isabsolute.c
* \brief Determines if a path is absolute or relative.
- * \author Copyright (c) 2002-2009 Jason Perkins and the Premake project
+ * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
*/
#include "premake.h"
@@ -10,13 +10,18 @@
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;
- }
+ lua_pushboolean(L, do_isabsolute(path));
+ return 1;
+}
+
+
+int do_isabsolute(const char* path)
+{
+ return (
+ path[0] == '/' ||
+ path[0] == '\\' ||
+ path[0] == '$' ||
+ (path[0] == '"' && path[1] == '$') ||
+ (path[0] != '\0' && path[1] == ':')
+ );
}