Skip to content
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

classlib: fix String methods that use path separators #3634

Merged
merged 8 commits into from
Apr 19, 2018
Merged

classlib: fix String methods that use path separators #3634

merged 8 commits into from
Apr 19, 2018

Conversation

mossheim
Copy link
Contributor

@mossheim mossheim commented Apr 5, 2018

Specifically, +/+, withTrailingSlash, withoutTrailingSlash

This is a fix for a bug reported on the mailing list (link forthcoming). Basically, the way we were testing for path separators wasn't very portable or robust.

Also adds tests and documentation.

Shoutout to @aspiers - I was using guard for this and it made the whole process so much smoother!

@mossheim
Copy link
Contributor Author

mossheim commented Apr 5, 2018

I have tested this locally and the tests pass. I hackily checked it for Windows by changing the implementation of isPathSeparator and pathSeparator to be the same as WindowsPlatform's; the tests pass for that too. I can test on my Windows VM as well.

Some things that came up during this fix:

  • there might be other methods relying on these bad checks. Checks on path separators should be done using isPathSeparator on either Platform or Char. Directly comparing with thisProcess.platform.pathSeparator is incorrect.
  • PathName has no equality comparison operator. IMO, comparing two PathName objects should be the same as comparing their fullPaths
  • IMO, we should deprecate withTrailingSlash and withoutTrailingSlash in favor of more appropriate names. This current naming is Unix-biased. I'll open a ticket or PR for it if people agree.

@mossheim mossheim added this to the 3.10 milestone Apr 6, 2018
@patrickdupuis patrickdupuis merged commit 4880b66 into supercollider:develop Apr 19, 2018
@mossheim mossheim deleted the topic/path-append branch April 19, 2018 21:34
@aspiers
Copy link
Contributor

aspiers commented Apr 20, 2018

Shoutout to @aspiers - I was using guard for this and it made the whole process so much smoother!

Awesome! Really happy to hear that 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants