Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_absolute creates only UNIX paths if base is not absolute #14

Closed
bgrieco opened this issue Oct 2, 2020 · 3 comments
Closed

get_absolute creates only UNIX paths if base is not absolute #14

bgrieco opened this issue Oct 2, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@bgrieco
Copy link

bgrieco commented Oct 2, 2020

on line 651

  // The basename should be an absolute path if the caller is using the API
  // correctly. However, he might not and in that case we will append a fake
  // root at the beginning.
  if (cwk_path_is_absolute(base)) {
    i = 0;
  } else {
    paths[0] = "/";
    i = 1;
  }

The function produces a weird Unix path if the base is not absolute in windows.
There could be some thought about trying to see if the appended path has a root in those cases
since assuming c:\ as a root is not the best option.

BTW, I stumbled on this because I tried path_join and could not produce absolute paths with it.

@likle likle added the bug Something isn't working label Oct 2, 2020
@likle
Copy link
Owner

likle commented Oct 2, 2020

Hi @bgrieco !

This is indeed imperfect. I am going to change cwk_path_get_absolute to use a backslash instead, since a backslash without drive letter will reference to the current drive. Please don't call cwk_path_get_absolute with a relative base. The base should be absolute.

I would really be interested in what didn't work with path_join and appreciate further information there!

@likle
Copy link
Owner

likle commented Oct 2, 2020

I pushed those changes in 1dac5f1, they are available on the master branch.

@likle
Copy link
Owner

likle commented Oct 5, 2020

Please let me know if you still encounter issues with this after the previous commit.

@likle likle closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants