Open bruchar1 opened 2 weeks ago
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)
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
.
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
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
Fixes https://github.com/mesonbuild/meson/issues/13130.
Fixes https://github.com/mesonbuild/meson/pull/11456.
join_paths
function now have aflavor
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 amode
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.