private ServiceViewFileInfo GetServiceViewFileInfo(string org, string service, string edition, string viewName) { string physicalPath = GetPhysicalPath(org, service, edition, viewName); string packagePath = string.Empty; if (_usePackage) { packagePath = GetServicePackage(org, service, edition); } if (physicalPath == null) { return(null); } var fileInfo = new ServiceViewFileInfo(physicalPath, packagePath) { Name = _viewName }; if (!fileInfo.Name.EndsWith(".cshtml")) { fileInfo.Name += ".cshtml"; } return(fileInfo); }
/// <summary> /// Locate a file at the given path by directly mapping path segments to physical directories. /// </summary> /// <param name="subpath">A path under the root directory</param> /// <returns>The file information. Caller must check Exists property. </returns> public IFileInfo GetFileInfo(string subpath) { // Relative paths starting with a leading slash okay if (subpath.StartsWith("/", StringComparison.Ordinal)) { subpath = subpath.Substring(1); } if (!IsServicePath(subpath)) { return(new NotFoundFileInfo(subpath)); } PopulateServiceVariables(subpath); ServiceViewFileInfo fileInfo = GetServiceViewFileInfo(_org, _service, _edition, _viewName); if (fileInfo == null) { return(new NotFoundFileInfo(subpath)); } return(fileInfo); }