Skip to content

Commit

Permalink
Fix relative pragma tests
Browse files Browse the repository at this point in the history
When relative pragmas are enabled, and includes already have relative
path, and there is no base bath from which to calculate relative paths,
use the existing relative path as-is.
  • Loading branch information
mhutch committed Jan 23, 2024
1 parent 44a3f6e commit 18ca3f2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ static void GenerateTransformMethod (CodeTypeDeclaration templateType, TemplateS
if (!settings.NoLinePragmas) {
var filename = seg.StartLocation.FileName ?? templateFile;
if (!string.IsNullOrEmpty (filename)) {
filename = Path.GetFullPath (filename);
if (pragmasRelativeToDirectory is not null) {
if (!settings.RelativeLinePragmas) {
filename = Path.GetFileName (filename);
} else if (pragmasRelativeToDirectory is not null) {
filename = Path.GetFullPath (filename);
filename = FileUtil.AbsoluteToRelativePath (pragmasRelativeToDirectory, filename);
}
}
Expand Down

0 comments on commit 18ca3f2

Please sign in to comment.