Windows module: Make path flattening for windres work in more cases

If either 'name' or 'name_formatted' are absolute paths,
then they are of the form:

C:\path/to/file.ext                            (example)

By only substituting slashes with the underscore, we get:

C:_path_to_file.ext

This is still not quite right, infact os.path.basename()
returns:

_path_to_file.ext

Also replace colons with underscores to overcome issues when
absolute paths are involved.
pull/9302/head
Luca Bacci 3 years ago committed by Eli Schwartz
parent a864269817
commit 6d1e182476
  1. 4
      mesonbuild/modules/windows.py

@ -145,8 +145,8 @@ class WindowsModule(ExtensionModule):
raise MesonException(f'Unexpected source type {src!r}. windows.compile_resources accepts only strings, files, custom targets, and lists thereof.')
# Path separators are not allowed in target names
name = name.replace('/', '_').replace('\\', '_')
name_formatted = name_formatted.replace('/', '_').replace('\\', '_')
name = name.replace('/', '_').replace('\\', '_').replace(':', '_')
name_formatted = name_formatted.replace('/', '_').replace('\\', '_').replace(':', '_')
res_kwargs = {
'output': name + '_@BASENAME@.' + suffix,

Loading…
Cancel
Save