Skip to content

Conversation

@Fiouz
Copy link

@Fiouz Fiouz commented Aug 2, 2022

Windows uses the \ backslash character as the directory separator, which
interferes with the standard Groovy escaping.

@tha2015
Copy link
Collaborator

tha2015 commented Aug 2, 2022

How about using / as the separator? It should work with both Windows and *nix

Pass values using JSON encapsulation via system property.

- This removes the need to escape/transform strings
- This allows the test to work under Windows, which uses the \ backslash
  character as the directory separator
- This also make the test work in case other special characters are in
  the path such as ' (quote)
@Fiouz Fiouz force-pushed the fix_Windows_unit_tests branch from a318c9e to 0f88f7f Compare August 2, 2022 23:53
@Fiouz
Copy link
Author

Fiouz commented Aug 2, 2022

PR modified to adopt a safer and more generic approach; instead, we use a system property to pass a JSON-encapsulated value around (we rely on Groovy JsonOutput/JsonSlurper):

  • no need to worry about the Groovy parser/compiler escaping rules (\ was only one special case among others), value is now a runtime value
  • no need to transform values, because the runtime Gradle API knows how to handle native paths

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.

2 participants