Skip to content

Commit

Permalink
FIX proper relative folder calculation (github issue #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
pocomane committed Jan 8, 2023
1 parent 58e7d50 commit 5882d5d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ static int rebase_canon_path(const char* base, const char* path, char* buf, size
// Find common prefix
size_t prefix = 0;
for (size_t c = 0; base[c] == path[c] && '\0' != base[c] && '\0' != path[c]; c += 1)
prefix += 1;
if (base[c] == '/') prefix = c + 1;

// Expand the right number of ../
for (int c = 0; c < blen - prefix; c+=1){
Expand Down Expand Up @@ -972,6 +972,7 @@ static int rebase_path(const char* base, const char* path, char* buf, size_t len
if (res) return res;
res = reduce_path(rpath, rpath, sizeof(rpath));
if (res) return res;

return rebase_canon_path(rbase, rpath, buf, len);
}

Expand Down

0 comments on commit 5882d5d

Please sign in to comment.