Skip to content

Commit 88f1b3f

Browse files
committed
don't generate <DependsUpon> if in different folder
1 parent b51870a commit 88f1b3f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Generaid.Tests/Model.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class CompanyGenerator : ITransformer
1212
public CompanyGenerator(Company company) { _company = company; }
1313
private readonly Company _company;
1414
public string Name =>
15-
(_company.NeedSubfolder ? "companies/" : "")
15+
(_company.NeedSubfolder ? @"companies\" : "")
1616
+ _company.Name;
1717
public string TransformText() => _company.Name;
1818
}

Generaid/Internal/GenNode.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@ internal sealed class GenNode : INodeOwner
1717

1818
int INodeOwner.Level => Owner.Level + 1;
1919
public string GeneratedDirName => Owner.GeneratedDirName;
20-
public string DependentUpon => NodeOwner?.Name;
20+
public string DependentUpon
21+
{
22+
get
23+
{
24+
if (NodeOwner == null) return null;
25+
var ownerDir = _fs.Path.GetDirectoryName(NodeOwner.FullName);
26+
var myDir = _fs.Path.GetDirectoryName(FullName);
27+
return ownerDir != myDir ? null : NodeOwner.Name;
28+
}
29+
}
2130
public string FullName => GeneratedDirName + "\\" + Name;
2231

2332
public GenNode(ITransformer transformer, IEnumerable<GenNode> nodes, IFileSystem fs)

0 commit comments

Comments
 (0)