private static string GetAppRelativePath(string path, IAgentBasedActionExecutionContext context) { if (string.IsNullOrEmpty(path)) { return(string.Empty); } if (path.StartsWith("~\\") || path.StartsWith("~/")) { var appDir = context.ApplicationDirectory; return(PathEx.Combine(appDir, path.Substring(2))); } return(path); }
private static ILegacyVariableEvaluationContext FindVariableEvaluationContext(IAgentBasedActionExecutionContext context) { var wrappedContext = new SimpleBuildMasterContext(context); var type = Type.GetType("Inedo.BuildMaster.Variables.StandardVariableEvaluationContext,BuildMaster", false); if (type != null) { return((ILegacyVariableEvaluationContext)Activator.CreateInstance(type, wrappedContext, context.Variables)); } else { type = Type.GetType("Inedo.BuildMaster.Variables.LegacyVariableEvaluationContext,BuildMaster", true); return((ILegacyVariableEvaluationContext)Activator.CreateInstance(type, wrappedContext, context.Variables)); } }