-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
Join paths kwargs #13165
Conversation
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.
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.
518d7fd
to
2afa78d
Compare
What is the specific use case for this? I.e. when would you need to explicitly join paths in the non-native way? |
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) |
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 |
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 |
Usually that would be the case, but if we're striving for some semblance of correctness, then the reverse case must also be acknowledged.
Yeah, when you're not using native NT paths or some other weird crap windows supports and nobody knows about |
Fixes #13130.
Fixes #11456.
join_paths
function now have aflavor
keyword, to specifywhether 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 amode
keyword, to specifyhow 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.