Closed Hannnes1 closed 5 months ago
Oops, seems like I messed up a rebase. Will fix...
There we go.
I should also note that the URL for fetching the files is a localhost right now, until we know what the final URLs will be.
If you want to test this now, you can start the following Python server, and place zip files named [targetPlatform]-libraries.zip
in the same directory that you run the server in.
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
class DownloadHandler(BaseHTTPRequestHandler):
def do_GET(self):
# Get requested file path
requested_file = self.path.lstrip("/")
# Check if file exists
if not os.path.exists(requested_file):
self.send_error(404, "File not found")
return
# Check if it's a zip file
if not os.path.splitext(requested_file)[1] == ".zip":
self.send_error(403, "Only zip files allowed for download")
return
# Serve the zip file
self.send_response(200)
self.send_header('Content-Type', 'application/zip')
self.end_headers()
with open(requested_file, 'rb') as f:
self.wfile.write(f.read())
# Define directory containing zip files (replace with your path)
download_dir = "/path/to/your/zip/files"
# Start the server on port 8000 (you can change the port)
port = 8000
server_address = ('', port)
httpd = HTTPServer(server_address, DownloadHandler)
print(f"Server listening on port {port}")
httpd.serve_forever()
This looks great! Thank you. I'm currently uploading the binaries to Cloudflare (which seems to be a bit faster than GitHub) and will merge this with some Windows-related changes.
This pull request addresses #19 by adding a
_downloadLibraries
tohooks/build.dart
.The function downloads the native libraries for the target platform to
.dart_tool/dart_filament/native/lib
as per the official guidelines.If the output folder for the libraries already exists (e.g.
.dart_tool/dart_filament/native/lib/android
) it is assumed that all library files are present. This might not be the case if a user has removed files manually, or if more libraries are added in the future. If we want to avoid those kind of issues, each file would have to be checked instead. I don't believe that that is something worth doing, however.