fix, duplicated sources when a sourcesPath item included a trailing directory separator

This commit is contained in:
Basile Burg 2015-09-19 14:01:53 +02:00
parent 2aee98ace0
commit 4c1941a3d4
1 changed files with 15 additions and 6 deletions

View File

@ -5,7 +5,7 @@ unit ce_dubproject;
interface interface
uses uses
Classes, SysUtils, fpjson, jsonparser, jsonscanner, process, Classes, SysUtils, fpjson, jsonparser, jsonscanner, process, strutils,
ce_common, ce_interfaces, ce_observer; ce_common, ce_interfaces, ce_observer;
type type
@ -450,6 +450,7 @@ var
conf: TJSONObject; conf: TJSONObject;
arr: TJSONArray; arr: TJSONArray;
i: integer; i: integer;
procedure tryAddFromFolder(const pth: string); procedure tryAddFromFolder(const pth: string);
var var
abs: string; abs: string;
@ -463,6 +464,8 @@ begin
fSrcs.Add(ExtractRelativepath(fBasePath, abs)); fSrcs.Add(ExtractRelativepath(fBasePath, abs));
end; end;
end; end;
var
pth: string;
begin begin
fSrcs.Clear; fSrcs.Clear;
lst := TStringList.Create; lst := TStringList.Create;
@ -480,8 +483,11 @@ begin
arr := TJSONArray(item); arr := TJSONArray(item);
for i := 0 to arr.Count-1 do for i := 0 to arr.Count-1 do
begin begin
tryAddFromFolder(fBasePath + arr.Strings[i]); pth := TrimRightSet(arr.Strings[i], ['/','\']);
tryAddFromFolder(arr.Strings[i]); if DirectoryExists(pth) then
tryAddFromFolder(pth)
else
tryAddFromFolder(fBasePath + pth);
end; end;
end; end;
// custom files // custom files
@ -505,8 +511,11 @@ begin
arr := TJSONArray(item); arr := TJSONArray(item);
for i := 0 to arr.Count-1 do for i := 0 to arr.Count-1 do
begin begin
tryAddFromFolder(fBasePath + arr.Strings[i]); pth := TrimRightSet(arr.Strings[i], ['/','\']);
tryAddFromFolder(arr.Strings[i]); if DirectoryExists(pth) then
tryAddFromFolder(pth)
else
tryAddFromFolder(fBasePath + pth);
end; end;
end; end;
// custom files in current config // custom files in current config