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

Problem with loading abolute path scripts with #load preprocessor #2154

Closed
Kemyke opened this issue May 16, 2018 · 1 comment
Closed

Problem with loading abolute path scripts with #load preprocessor #2154

Kemyke opened this issue May 16, 2018 · 1 comment
Milestone

Comments

@Kemyke
Copy link

Kemyke commented May 16, 2018

What You Are Seeing?

Loading a script with absolute path is only working if the full definition is applied: #load \"local:?path=c:/utils.cake\". It is not working with legacy format #load \"c:/utils.cake\".

What is Expected?

It should work for both syntaxes.

What version of Cake are you using?

0.27.1

Are you running on a 32 or 64 bit system?

64 bit

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

No.

The problem is with the ParseUriFromTokens method in UriDirectiveProcessor class. It first tries to create Uri from the token. If it is a relative path the creation will fail and the CreateUriFromLegacyFormat will be applied because of the UriKind.Absolute parameter in TryCreate call. But if the token is an absolute path, the Uri creation will success and the Uri will be file:///c:/CakeScripts/utils.cake. But this Uri won't be processed because in FileLoadDirectiveProvider class the CanLoad method will return false because the Scheme will be file and not local as expected.
Maybe the Uri.TryCreate is not the best way to decide if the CreateUriFromLegacyFormat should be applied or not. Maybe it would be better to have a previous step which check if the token is match with the appropriate regexp. (somtehing like [local|nuget]:\?)

@devlead
Copy link
Member

devlead commented Jun 25, 2018

fixed by #2155

@devlead devlead closed this as completed Jun 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants