Skip to content

Avoid regex errors when running on Windows.#28

Open
sjp wants to merge 1 commit intojeffreyhorner:masterfrom
sjp:master
Open

Avoid regex errors when running on Windows.#28
sjp wants to merge 1 commit intojeffreyhorner:masterfrom
sjp:master

Conversation

@sjp
Copy link
Copy Markdown

@sjp sjp commented Mar 12, 2015

Hi,

A user of one of my packages emailed me with the following error message:

Error in grepl(paste("^", root, url, .Platform$file.sep, sep = ""), file_path) : 
  invalid regular expression '^C:\Users\USER\Documents\R\win-library\3.1\pkg\example/brew/', reason 'Invalid back reference'

This appeared to be caused by .Platform$file.sep being a backref in regex-land when used on Windows (i.e. .Platform$file.sep is \.

I made a minor change so that there is a char vector substring match instead of a regular expression (should be faster too, not that it matters).

Unfortunately I was unable to test whether this fixes the problem (don't have a Windows machine handy), but it does not break anything in Linux anyway.

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.

1 participant