Opium works, end to end

This commit is contained in:
Ruben Shekspir 2019-05-12 12:47:40 +04:00
parent 70e1e1efe4
commit 7e0050c496
5 changed files with 44 additions and 30 deletions

View file

@ -3,16 +3,24 @@ IMPORT FileManager, http, Strings, Logger, Settings, JsonParser;
CONST ArrayMaxNumber = 1000;
PROCEDURE ResolveFile *(host, port, path, packageName, version, fileName : ARRAY OF CHAR; VAR returnValue : ARRAY OF CHAR);
PROCEDURE ResolveFile *(host, port, path, packageName, fileName : ARRAY OF CHAR; VAR returnValue : ARRAY OF CHAR);
VAR
localPath: ARRAY ArrayMaxNumber OF CHAR;
isSuccessfull: BOOLEAN;
BEGIN
Logger.Log('path');
Logger.Log(path);
http.get(host, port, path, returnValue);
http.getClean(returnValue, returnValue);
isSuccessfull := FileManager.CreateDirectory(packageName, Settings.installPath);
IF ~isSuccessfull THEN Logger.Log("Something went wrong, while downloading files") END;
ASSERT(isSuccessfull);
Logger.Log(path);
Logger.Log(packageName);
COPY(Settings.installPath, localPath);
Strings.Append("/", localPath);
Strings.Append(packageName, localPath);
Strings.Append("/", localPath);
@ -25,11 +33,16 @@ END ResolveFile;
PROCEDURE Resolve *(host, port, path, packageName, version: ARRAY OF CHAR; files: ARRAY OF JsonParser.TString);
VAR
i : LONGINT;
returnValue: JsonParser.TString;
helperString: ARRAY 10000 OF CHAR;
BEGIN
Strings.Append("/", path);
FOR i := 0 TO LEN(files) - 1 DO
IF ~Strings.Match(files[i], "") THEN
ResolveFile(host, port, path, packageName, version, files[i], returnValue);
JsonParser.Empty(helperString);
COPY(path, helperString);
Strings.Append(files[i], helperString);
ResolveFile(host, port, helperString, packageName, files[i], helperString);
END;
END;
END Resolve;