fix, the target filename was not always correctly set

This commit is contained in:
Basile Burg 2015-09-19 14:02:39 +02:00
parent 4c1941a3d4
commit ef7488316a
1 changed files with 21 additions and 23 deletions

View File

@ -615,36 +615,34 @@ begin
end; end;
procedure TCEDubProject.updateOutputNameFromJson; procedure TCEDubProject.updateOutputNameFromJson;
procedure setFrom(obj: TJSONObject);
var
item: TJSONData;
begin
item := obj.Find('targetPath');
if assigned(item) then
fOutputFileName := item.AsString;
item := obj.Find('targetName');
if assigned(item) then
fOutputFileName += DirectorySeparator + item.AsString;
end;
var var
conf: TJSONObject; conf: TJSONObject;
item: TJSONData; item: TJSONData;
namePart, pathPart: string;
procedure setFrom(obj: TJSONObject);
var
n,p: TJSONData;
begin
p := obj.Find('targetPath');
n := obj.Find('targetName');
if assigned(p) then pathPart := p.AsString;
if assigned(n) then namePart := n.AsString;
end;
begin begin
fOutputFileName := ''; fOutputFileName := '';
item := fJSON.Find('name');
if not assigned(item) then
exit;
namePart := item.AsString;
pathPart := fBasePath;
setFrom(fJSON); setFrom(fJSON);
conf := getCurrentCustomConfig; conf := getCurrentCustomConfig;
if assigned(conf) then setFrom(conf); if assigned(conf) then
if fOutputFileName <> '' then setFrom(conf);
begin pathPart := TrimRightSet(pathPart, ['/','\']);
patchPlateformPath(fOutputFileName); fOutputFileName:= pathPart + DirectorySeparator + namePart;
expandFilenameEx(fBasePath, fOutputFileName); patchPlateformPath(fOutputFileName);
end fOutputFileName := expandFilenameEx(fBasePath, fOutputFileName);
else
begin
item := fJSON.Find('name');
if assigned(item) then
fOutputFileName := fBasePath + item.AsString;
end;
case fBinKind of case fBinKind of
executable: fOutputFileName += exeExt; executable: fOutputFileName += exeExt;
staticlib: fOutputFileName += libExt; staticlib: fOutputFileName += libExt;