Make sure when the backend cannot be downloaded or the site resolved that we're forgiving until we try to use the provided FFI functions.

This commit is contained in:
2026-04-05 23:43:16 +02:00
parent 6af1fa208b
commit 1f4f8a1fbd
5 changed files with 131 additions and 48 deletions

View File

@@ -4,6 +4,7 @@
net/sendurl
net/url
net/url-connect
net/dns
racket/file
racket/system
racket/string
@@ -15,6 +16,7 @@
racket-webview-qt-directory
racket-webview-qt-is-available?
racket-webview-qt-is-downloadable?
racket-webview-qt-resolves?
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -101,20 +103,30 @@
(define (racket-webview-qt-directory)
(if (racket-webview-qt-is-available?)
(build-path (format "~a/~a-~a" install-path rkt-qt-os rkt-qt-arch))
(build-path install-path (format "~a-~a" rkt-qt-os rkt-qt-arch))
#f))
(define (racket-webview-qt-resolves?)
(if (eq? (dns-find-nameserver) #f)
#f
(with-handlers ([exn:fail? (λ (e) #f)])
(dns-get-address (dns-find-nameserver) rkt-qt-download-site)
#t)
)
)
(define (racket-webview-qt-version)
(if (racket-webview-qt-is-available?)
(file->value version-file)
#f))
(define (racket-webview-qt-is-downloadable?)
(let ((in (download-port rkt-download-url)))
(let ((d (input-port? in)))
(when d
(close-input-port in))
d)))
(with-handlers ([exn:fail? (λ (e) #f)])
(let ((in (download-port rkt-download-url)))
(let ((d (input-port? in)))
(when d
(close-input-port in))
d))))
(define (download-racket-webview-qt)
(let ((in (download-port rkt-download-url)))