diff --git a/src/u_libmaneditor.pas b/src/u_libmaneditor.pas index 45a7f6cb..eca1a30b 100644 --- a/src/u_libmaneditor.pas +++ b/src/u_libmaneditor.pas @@ -338,7 +338,7 @@ begin if assigned(fList) then fillList else - dlgOkError('could not get the package list, check you connection or that curl library is setup'); + dlgOkError('could not get the package list, ' + simpleGetErrMsg); end; procedure TDubPackageQueryForm.fillList; diff --git a/src/u_main.pas b/src/u_main.pas index 1af5eeec..4ee1e479 100644 --- a/src/u_main.pas +++ b/src/u_main.pas @@ -2035,7 +2035,7 @@ begin res.free; end; end - else dlgOkError('Impossible to check new versions, no connectivity or lib CURL not installed'); + else dlgOkError('Impossible to check new versions, ' + simpleGetErrMsg); end; procedure TMainForm.DoFirstShow; diff --git a/src/u_simpleget.pas b/src/u_simpleget.pas index e7d2fa20..c42c7aec 100644 --- a/src/u_simpleget.pas +++ b/src/u_simpleget.pas @@ -10,13 +10,19 @@ uses type PStream = ^TStream; -// Get the content of url in the string data +// Get the content of 'url' in the string 'data' function simpleGet(url: string; var data: string): boolean; overload; -// Get the content of url in the stream data +// Get the content of 'url' in the stream 'data' function simpleGet(url: string; data: TStream): boolean; overload; -// Get the content of url in the JSON data, supposed to be a nil instance. +// Get the content of 'url' in the JSON 'data', supposed to be a nil instance. function simpleGet(url: string; var data: TJSONData): boolean; overload; +const + {$ifdef windows} libcurlFname = 'libcurl.dll'; {$endif} + {$ifdef linux} libcurlFname = 'libcurl.so'; {$endif} + {$ifdef darwin} libcurlFname = 'libcurl.dylib'; {$endif} + simpleGetErrMsg = 'no network or ' + libcurlFname + ' not setup correctly'; + implementation var @@ -35,7 +41,6 @@ end; function simpleGetClbckForStream(buffer:Pchar; size:PtrInt; nitems:PtrInt; appender: PStream): PtrInt; cdecl; begin - assert(appender <> nil); try result := appender^.write(buffer^, size * nitems); except @@ -46,7 +51,6 @@ end; function simpleGetClbckForString(buffer:Pchar; size:PtrInt; nitems:PtrInt; appender: PString): PtrInt; cdecl; begin - assert(appender <> nil); result := size* nitems; try (appender^) += buffer;