-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Cake Frosting Parent DirectoryPath Fails To Combine with Slash #3352
Comments
GetFiles takes a string so it will implicitly convert the content to a string. Try using |
Didn't help, I'm afraid. More specifically: [TaskName("Fail")]
public class FailTask : FrostingTask<BuildContext>
{
private BuildContext? _context;
private DirectoryPath RootDir => _context.Directory("..");
private DirectoryPath TestDir => RootDir + _context.Directory("temp");
public override void Run(BuildContext context)
{
_context = context;
var filePath = TestDir.CombineWithFilePath(context.File("*.zip"));
_context.Information(filePath);
}
} returns I'd be inclined to argue that a null reference exception from |
Found a workaround. If you replace:
with
then it works. Strange bug, I can't even begin to understand how that syntax change could make a difference. Just to make this easily reproduceable: [TaskName("Fail")]
public class FailTask : FrostingTask<BuildContext>
{
private BuildContext? _context;
private DirectoryPath RootDir => _context.Directory("..");
private DirectoryPath TestDir1 => RootDir + _context.Directory("temp");
private DirectoryPath TestDir2 => RootDir.Combine(_context.Directory("temp"));
public override void Run(BuildContext context)
{
_context = context;
_context.Information(TestDir1);
_context.Information(TestDir2);
}
} returns:
but should return:
|
…ator to ConvertableDirectoryPath
Oh, of course! That makes sense. Thanks @augustoproiete, looking forward to the next release. |
@lprichar Thanks for reporting! Nice find! |
…ator to ConvertableDirectoryPath
🎉 This issue has been resolved in version v1.3.0 🎉 The release is available on: Your GitReleaseManager bot 📦🚀 |
Prerequisites
Cake runner
Cake Frosting
Cake version
1.1.0
Operating system
Linux, Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
A NullReferenceException in the code sample below. However, that's more the symptom than the cause. The problem appears to be that Cake Frosting is combining
Directory("..") + Directory("temp")
into"..temp"
rather than"../temp"
when you capture the context and then use expression bodied properties.This may seem obscure, but I'm converting a large codebase of DSL Cake into Frosting and am looking for ways to accomplish it with minimal changes.
What is expected?
It should run to completion without an exception
Steps to Reproduce
Run this:
Output log
The text was updated successfully, but these errors were encountered: