mirror of https://gitlab.com/basile.b/dexed.git
use DUB convert to get dub JSON from SDL
This commit is contained in:
parent
bbebbc9686
commit
10ee87bfbb
|
|
@ -1115,26 +1115,31 @@ begin
|
||||||
dub.Options := [poUsePipes{$IFDEF WINDOWS}, poNewConsole{$ENDIF}];
|
dub.Options := [poUsePipes{$IFDEF WINDOWS}, poNewConsole{$ENDIF}];
|
||||||
dub.ShowWindow := swoHIDE;
|
dub.ShowWindow := swoHIDE;
|
||||||
dub.CurrentDirectory:= filename.extractFilePath;
|
dub.CurrentDirectory:= filename.extractFilePath;
|
||||||
dub.Parameters.Add('describe');
|
dub.Parameters.Add('convert');
|
||||||
|
dub.Parameters.Add('-s');
|
||||||
|
dub.Parameters.Add('-f');
|
||||||
|
dub.Parameters.Add('json');
|
||||||
dub.Execute;
|
dub.Execute;
|
||||||
processOutputToStrings(dub, str);
|
processOutputToStrings(dub, str);
|
||||||
while dub.Running do;
|
while dub.Running do;
|
||||||
prs := TJSONParser.Create(str.Text, [joIgnoreTrailingComma, joUTF8]);
|
prs := TJSONParser.Create(str.Text, [joIgnoreTrailingComma, joUTF8]);
|
||||||
|
try
|
||||||
try
|
try
|
||||||
jsn := prs.Parse;
|
jsn := prs.Parse;
|
||||||
try
|
try
|
||||||
if jsn.isNotNil and (jsn.JSONType = jtObject)
|
if jsn.isNotNil then
|
||||||
and TJSONObject(jsn).Find('packages').isNotNil
|
result := TJSONObject(jsn.Clone)
|
||||||
and (TJSONObject(jsn).Find('packages').JSONType = jtArray)
|
else
|
||||||
and (TJSONArray(TJSONObject(jsn).Find('packages')).Count > 0)
|
result := nil;
|
||||||
and (TJSONArray(TJSONObject(jsn).Find('packages')).Items[0].JSONType = jtObject) then
|
|
||||||
result := TJSONObject(TJSONArray(TJSONObject(jsn).Find('packages')).Items[0].Clone);
|
|
||||||
finally
|
finally
|
||||||
jsn.free;
|
jsn.free;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
prs.Free
|
prs.Free
|
||||||
end;
|
end;
|
||||||
|
except
|
||||||
|
result := nil;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
SetCurrentDirUTF8(old);
|
SetCurrentDirUTF8(old);
|
||||||
dub.free;
|
dub.free;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue