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

Join paths kwargs #13165

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

bruchar1
Copy link
Member

@bruchar1 bruchar1 commented May 1, 2024

Fixes #13130.

Fixes #11456.

join_paths function now have a flavor keyword, to specify
whether it joins posix or windows paths.

The default 'meson' flavor keeps compatibility with previous meson
versions. 'posix' and 'windows' flavors handle paths as posix or windows
paths. 'native' flavor uses 'posix' or 'windows' flavor depending on the
host system.

join_paths function now have a mode keyword, to specify
how it joins absolute paths.

In 'relative' mode (default), the last absolute component of the path
becomes the path starting point.

In 'absolute' mode, each subsequent parts are joined as if they were
relative to the preceding parts.

Fixes mesonbuild#13130.

`join_paths` function now have a `flavor` keyword, to specify
whether it joins posix or windows paths.

The default 'meson' flavor keeps compatibility with previous meson
versions. 'posix' and 'windows' flavors handle paths as posix or windows
paths. 'native' flavor uses 'posix' or 'windows' flavor depending on the
host system.
@bruchar1 bruchar1 requested a review from jpakkane as a code owner May 1, 2024 16:54
Fixes mesonbuild#11456.

`join_paths` function now have a `mode` keyword, to specify
how it joins absolute paths.

In 'relative' mode (default), the last absolute component of the path
becomes the path starting point.

In 'absolute' mode, each subsequent parts are joined as if they were
relative to the preceding parts.
@jpakkane
Copy link
Member

jpakkane commented May 2, 2024

What is the specific use case for this? I.e. when would you need to explicitly join paths in the non-native way?

@bruchar1 bruchar1 marked this pull request as draft May 2, 2024 12:28
@bruchar1
Copy link
Member Author

bruchar1 commented May 2, 2024

You're right. The real problem with actual implementation I think is that backslashes should not be replaced on posix paths. I proposed a fix in #13172 . I will rework the actual PR to only keep the other feature (absolute path joining)

@Akaricchi
Copy link
Contributor

What is the specific use case for this? I.e. when would you need to explicitly join paths in the non-native way?

When you're cross-compiling and need to embed a path into your program: https://github.com/taisei-project/taisei/blob/071d1163fdb136b35ff78a538842d8448e95cdaf/meson.build#L529

I don't remember the details, but I was frustrated enough with this to name the actual path conversion script unfuck-path.py.

@eli-schwartz
Copy link
Member

I would blindly assume in that case you're usually cross compiling from Linux, to Windows. In which case Windows does accept the same forward slashes Linux does, when using the recommended Windows path handling APIs. I wish the world would just standardize on using those everywhere. :P

@Akaricchi
Copy link
Contributor

I would blindly assume in that case you're usually cross compiling from Linux, to Windows

Usually that would be the case, but if we're striving for some semblance of correctness, then the reverse case must also be acknowledged.

In which case Windows does accept the same forward slashes Linux does, when using the recommended Windows path handling APIs

Yeah, when you're not using native NT paths or some other weird crap windows supports and nobody knows about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

join_paths() works wrong when meet Windows style absolute path
4 participants