Merge pull request #1395 from LORgames/ssurtees/normalizeFix
Fixed edge case in path.normalize
This commit is contained in:
commit
a640f86d5b
@ -181,8 +181,7 @@ int path_normalize(lua_State* L)
|
||||
|
||||
// path is surrounded with quotes
|
||||
if (readPtr != endPtr &&
|
||||
IS_QUOTE(*readPtr) && IS_QUOTE(endPtr[-1]) &&
|
||||
*readPtr == endPtr[-1])
|
||||
IS_QUOTE(*readPtr))
|
||||
{
|
||||
*(writePtr++) = *(readPtr++);
|
||||
}
|
||||
|
@ -740,3 +740,19 @@
|
||||
-- End
|
||||
test.isequal("../../test/${MYVAR}", path.normalize("../../test/${MYVAR}"))
|
||||
end
|
||||
|
||||
function suite.normalize_quotedpath_withTokens()
|
||||
-- Premake tokens
|
||||
test.isequal("\"%{wks.location}../../test\"", path.normalize("\"%{wks.location}../../test\""))
|
||||
-- Visual Studio var
|
||||
test.isequal("\"$(SolutionDir)../../test\"", path.normalize("\"$(SolutionDir)../../test\""))
|
||||
-- Windows env var
|
||||
test.isequal("\"%APPDATA%../../test\"", path.normalize("\"%APPDATA%../../test\""))
|
||||
-- Unix env var
|
||||
test.isequal("\"${HOME}../../test\"", path.normalize("\"${HOME}../../test\""))
|
||||
|
||||
-- Middle
|
||||
test.isequal("\"../../${MYVAR}/../test\"", path.normalize("\"../../${MYVAR}/../test\""))
|
||||
-- End
|
||||
test.isequal("\"../../test/${MYVAR}\"", path.normalize("\"../../test/${MYVAR}\""))
|
||||
end
|
||||
|
Reference in New Issue
Block a user