Rework path handling on native Windows #217

Merged
lazka merged 1 commits from win-path-rework into master 2021-03-20 14:59:38 +00:00
lazka commented 2021-03-20 10:48:48 +00:00 (Migrated from github.com)

The current approach was to parse the .pc and, detect the prefix, throw
everything together and at the end replace all \ with / to not produce invalid
escape sequences.

This has the problem that escaping in .pc files is ignored and no longer
possible. Also in case the prefix path has a space in it the result would be
invalid because of missing escaping.

This changes the following things:

  • We no longer normalize values at the end. Instead we assume .pc files use "/"
    as a directory separator or "\\", same format as under Unix. "\" alone no
    longer works. This shouldn't be a problem since most build tools produce .pc
    files with "/" like meson, cmake, autotools.

  • When injecting the prefix at runtime we convert the prefix to use "/" and
    escape spaces so that in combination with the .pc content the result is a
    valid escaped path value again.

This patch has been used in MSYS2 for some months now.

See #212

The current approach was to parse the .pc and, detect the prefix, throw everything together and at the end replace all \ with / to not produce invalid escape sequences. This has the problem that escaping in .pc files is ignored and no longer possible. Also in case the prefix path has a space in it the result would be invalid because of missing escaping. This changes the following things: * We no longer normalize values at the end. Instead we assume .pc files use "/" as a directory separator or "\\\\", same format as under Unix. "\\" alone no longer works. This shouldn't be a problem since most build tools produce .pc files with "/" like meson, cmake, autotools. * When injecting the prefix at runtime we convert the prefix to use "/" and escape spaces so that in combination with the .pc content the result is a valid escaped path value again. This patch has been used in MSYS2 for some months now. See #212
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#217
There is no content yet.