|
148 | 148 | -- if I have an existing instance, create a new configuration |
149 | 149 | -- block for it so I don't pick up an old filter |
150 | 150 | if instance then |
151 | | - configset.addFilter(instance, {}, os.getcwd()) |
| 151 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 152 | + configset.addFilter(instance, {}, basedir) |
152 | 153 | end |
153 | 154 |
|
154 | 155 | -- otherwise, a new instance |
|
163 | 164 | -- (recursive call, so needs to be its own function) |
164 | 165 | api._clearContainerChildren(class) |
165 | 166 |
|
166 | | - -- active this container, as well as it ancestors |
| 167 | + -- active this container, as well as its ancestors |
167 | 168 | if not class.placeholder then |
168 | 169 | api.scope.current = instance |
169 | 170 | end |
|
716 | 717 | table.remove(api.scope.global.blocks, i) |
717 | 718 | end |
718 | 719 |
|
719 | | - configset.addFilter(api.scope.current, {}, os.getcwd()) |
| 720 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 721 | + configset.addFilter(api.scope.current, {}, basedir) |
720 | 722 | end |
721 | 723 |
|
722 | 724 |
|
|
802 | 804 | premake.field.kind("directory", { |
803 | 805 | paths = true, |
804 | 806 | store = function(field, current, value, processor) |
805 | | - return path.getabsolute(value) |
| 807 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 808 | + return path.getabsolute(value, basedir) |
806 | 809 | end, |
807 | 810 | remove = function(field, current, value, processor) |
808 | | - return path.getabsolute(value) |
| 811 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 812 | + return path.getabsolute(value, basedir) |
809 | 813 | end, |
810 | 814 | compare = function(field, a, b, processor) |
811 | 815 | return (a == b) |
|
829 | 833 | premake.field.kind("file", { |
830 | 834 | paths = true, |
831 | 835 | store = function(field, current, value, processor) |
832 | | - return path.getabsolute(value) |
| 836 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 837 | + return path.getabsolute(value, basedir) |
833 | 838 | end, |
834 | 839 | remove = function(field, current, value, processor) |
835 | | - return path.getabsolute(value) |
| 840 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 841 | + return path.getabsolute(value, basedir) |
836 | 842 | end, |
837 | 843 | compare = function(field, a, b, processor) |
838 | 844 | return (a == b) |
|
1087 | 1093 | premake.field.kind("path", { |
1088 | 1094 | paths = true, |
1089 | 1095 | store = function(field, current, value, processor) |
1090 | | - return path.deferredjoin(os.getcwd(), value) |
| 1096 | + local basedir |
| 1097 | + if field.cwdAsBase then |
| 1098 | + basedir = os.getcwd() |
| 1099 | + else |
| 1100 | + basedir = p.api.scope.current.basedir or os.getcwd() |
| 1101 | + end |
| 1102 | + return path.deferredjoin(basedir, value) |
1091 | 1103 | end, |
1092 | 1104 | compare = function(field, a, b, processor) |
1093 | 1105 | return (a == b) |
|
1152 | 1164 | if (type(terms) == "table" and #terms == 1 and terms[1] == "*") or (terms == "*") then |
1153 | 1165 | terms = nil |
1154 | 1166 | end |
1155 | | - local ok, err = configset.addFilter(api.scope.current, {terms}, os.getcwd()) |
| 1167 | + local basedir = p.api.scope.current.basedir or os.getcwd() |
| 1168 | + local ok, err = configset.addFilter(api.scope.current, {terms}, basedir) |
1156 | 1169 | if not ok then |
1157 | 1170 | error(err, 2) |
1158 | 1171 | end |
|
0 commit comments