Skip to content

Commit

Permalink
LuaFAR: change win.JoinPath a little (touch #77)
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Nov 5, 2024
1 parent f7ab02a commit d68c867
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Binary file modified luafar/manuals/luafar2m_manual.chm
Binary file not shown.
9 changes: 7 additions & 2 deletions luafar/src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,14 @@ static int win_JoinPath(lua_State *L)
luaL_buffinit(L, &buf);

for (idx=1; idx <= top; idx++) {
const char *s = luaL_optstring(L, idx, "");
if (*s == 0)
const char *s = luaL_checkstring(L, idx);
if (*s == 0) {
if (idx == top && !was_slash) { // treat empty string in last arg as delimiter
luaL_addchar(&buf, DELIM);
break;
}
continue;
}
if (!empty && !was_slash && *s != DELIM)
luaL_addchar(&buf, DELIM);
else if (was_slash && *s == DELIM)
Expand Down

0 comments on commit d68c867

Please sign in to comment.