DUB projects, detect dep import path from "path" property

This commit is contained in:
Basile Burg 2018-04-27 10:50:35 +02:00
parent 1ddae5765a
commit 8f0c4a52ad
1 changed files with 13 additions and 1 deletions

View File

@ -1306,6 +1306,7 @@ procedure TCEDubProject.updateImportPathsFromJson;
q: TSemVer;
u: PSemVer;
i: integer;
c: TJSONObject;
begin
if obj.findObject('dependencies' + suffix, deps) then
begin
@ -1317,8 +1318,19 @@ procedure TCEDubProject.updateImportPathsFromJson;
for i := 0 to deps.Count-1 do
begin
n := deps.Names[i];
s := z + n;
// local path specified
if deps.findObject(n, c) and c.findAny('path', j) then
begin
s := expandFilenameEx(fBasePath, j.AsString);
if (s + 'source').dirExists then
fImportPaths.Add(s)
else if (s + 'src').dirExists then
fImportPaths.Add(s);
continue;
end;
s := z + n;
// Try to fetch if not present at all
if not fLocalPackages.find(n, pck) and dubBuildOptions.autoFetch then
begin