You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]:\?)
The text was updated successfully, but these errors were encountered:
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 inUriDirectiveProcessor
class. It first tries to createUri
from the token. If it is a relative path the creation will fail and theCreateUriFromLegacyFormat
will be applied because of theUriKind.Absolute
parameter inTryCreate
call. But if the token is an absolute path, the Uri creation will success and theUri
will befile:///c:/CakeScripts/utils.cake
. But thisUri
won't be processed because inFileLoadDirectiveProvider
class theCanLoad
method will return false because theScheme
will befile
and notlocal
as expected.Maybe the
Uri.TryCreate
is not the best way to decide if theCreateUriFromLegacyFormat
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]:\?
)The text was updated successfully, but these errors were encountered: