Skip to content

Commit 9442cf8

Browse files
author
Tobias Brennecke
committed
#540 Patch Pattern.createEmpty to create a relPath when possible, so the graph can use it as ID
1 parent 606f96c commit 9442cf8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/lib/object_factory.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,16 @@ Pattern.prototype = {
146146
// factory: creates an empty Pattern for miscellaneous internal use, such as
147147
// by list_item_hunter
148148
Pattern.createEmpty = function (customProps, patternlab) {
149-
var pattern = new Pattern('', null, patternlab);
149+
let relPath = '';
150+
if (customProps) {
151+
if (customProps.relPath) {
152+
relPath = customProps.relPath;
153+
} else if (customProps.subdir && customProps.filename) {
154+
relPath = customProps.subdir + path.sep + customProps.filename;
155+
}
156+
}
157+
158+
var pattern = new Pattern(relPath, null, patternlab);
150159
return extend(pattern, customProps);
151160
};
152161

0 commit comments

Comments
 (0)