I'm trying to set up a consistent temp folder structure for a range of builds. Each build has its own folder and git-ignored "temp" subfolder. I'd like to have the path to the ".cake" file so I can use the relative ".\temp" folder.
I can get the directory to the executing Cake binaries (Context.Environment.ApplicationRoot
) and I can get the working directory (Context.Environment.WorkingDirectory
), but I can't see a way to get the path to the ".cake" file itself.
You could use Context.GetCallerInfo() alias, it returns a ScriptCallerInfo which contains a SourceFilePath property.
Example usage:
var callerInfo = Context.GetCallerInfo();
Information(
"{0}",
callerInfo.SourceFilePath
);