path.isabsolute() now recognizes quoted shell variables
This commit is contained in:
parent
8436afcd24
commit
a2aa2f83e1
@ -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-2012 Jason Perkins and the Premake project
|
||||
*/
|
||||
|
||||
#include "premake.h"
|
||||
@ -10,7 +10,11 @@
|
||||
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] == ':'))
|
||||
if (path[0] == '/' ||
|
||||
path[0] == '\\' ||
|
||||
path[0] == '$' ||
|
||||
(path[0] == '"' && path[1] == '$') ||
|
||||
(path[0] != '\0' && path[1] == ':'))
|
||||
{
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
|
@ -34,7 +34,7 @@
|
||||
test.isequal("$(HOME)/user", path.getabsolute("$(HOME)/user"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_OnMultipleEnvVar()
|
||||
function suite.getabsolute_OnMultipleEnvVar()
|
||||
test.isequal("$(HOME)/$(USER)", path.getabsolute("$(HOME)/$(USER)"))
|
||||
end
|
||||
|
||||
@ -43,6 +43,10 @@
|
||||
test.isequal(expected, path.getabsolute("home/$(USER)"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_OnLeadingEnvVarQuoted()
|
||||
test.isequal('"$(HOME)/user"', path.getabsolute('"$(HOME)/user"'))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- path.getbasename() tests
|
||||
|
Loading…
Reference in New Issue
Block a user