Merge pull request #191 from Lusito/feature/pathjoinfix
fix for path.join problem when both string start with a "..", a unit …
This commit is contained in:
commit
25bb49e4d5
@ -71,6 +71,10 @@ int path_join(lua_State* L)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (start[0] == '.' && start[1] == '.' && start[2] == '\0'){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* otherwise trim segment and the ".." sequence */
|
/* otherwise trim segment and the ".." sequence */
|
||||||
if (start != buffer) {
|
if (start != buffer) {
|
||||||
--start;
|
--start;
|
||||||
|
@ -267,6 +267,10 @@
|
|||||||
test.isequal("", path.join("p1/p2/", "../.."))
|
test.isequal("", path.join("p1/p2/", "../.."))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function suite.join_OnBothUpTwoFolders()
|
||||||
|
test.isequal("../../../../foo", path.join("../../", "../../foo"))
|
||||||
|
end
|
||||||
|
|
||||||
function suite.join_OnUptwoFolders()
|
function suite.join_OnUptwoFolders()
|
||||||
test.isequal("p1/foo", path.join("p1/p2/p3", "../../foo"))
|
test.isequal("p1/foo", path.join("p1/p2/p3", "../../foo"))
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user