You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This is due to extracting the asset folder from APK.
Need to make this faster, get rid of it (by reading directly from APK), or only do it once at install time (can hook this), or only if the files are not there.
TODO: more detail on this so you guys understand what I am talking about
Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code. The system will delete any files stored in this location both when your specific application is upgraded, and when the entire platform is upgraded.
@kkaefer what would be required to get the URL styles to load directly from a zip file? This would save extacting all the styles even if you are not using all of them
Also need to get curl to read the ca-bundle file from the zip too.
+1 on asset:// URLs. Why make it Android-specific though? This will make stylesheets that use that URL scheme platform specific. Instead, we could use this scheme to provide a couple of default styles/sprites/fonts that always ship with all applications.
I refrained from implementing the certificate loading from memory since it requires OpenSSL headers, which we don't necessarily have available on all platform, and I didn't want to add a direct dependency on it, as compiling OpenSSL can get quite hairy.
Just discovered that Android actually has a native version of the AssetManager in <android/asset_manager.h> so I might be able to get rid of libzip. Reopening.
@kkaefer no specific reason for it to be Android specific. I can refactor it to allow other platforms to implement it.
Interesting about OpenSSL headers. Perhaps we can just make it an #ifdef that is set on platforms that have OpenSSL headers and want to load certs from asset://?
@springmeyer was looking at switching from OpenSSL to Google's BoringSSL fork at least for Android. This is needed as OpenSSL has a compile bug on ARM Android that Google patched in their fork.
I think we should merge FileRequest and AssetRequest, and move the actual implementation to a platform-specific file, like HTTPRequest already does (it uses Cocoa stuff on OS X/iOS, and CURL on all other platforms).
FileRequest and AssetRequest are already very similar: relative paths in a file:// URLS are relative to the executable or bundle (iOS/OS X), which means they are already used to access "bundled" files like the stylesheet or image sprites.
This is implemented in other systems as well. OS X and iPhone bundles load data from the resources folder, Linux builds well load assets relative to the binary's location
Activity
ljbade commentedon Nov 11, 2014
Found Context.getPackageCodePath that may allow the C++ code to read styles directly from the APK zip file if we include C++ zip library.
Also I am going to restrict Assetbridge to extract only the files we need. This should make things faster. See #585
kkaefer commentedon Nov 11, 2014
Cache shaders: #588
ljbade commentedon Nov 11, 2014
Also getCodeCacheDir sounds useful:
But it is only on Android 5+
ljbade commentedon Nov 11, 2014
OK de1f37f includes the stuff to limit which files are extracted.
ljbade commentedon Nov 17, 2014
@kkaefer what would be required to get the URL styles to load directly from a zip file? This would save extacting all the styles even if you are not using all of them
Also need to get curl to read the ca-bundle file from the zip too.
ljbade commentedon Nov 17, 2014
Okay it looks like libzip is the way to go.
ljbade commentedon Nov 17, 2014
I am proposing a URL scheme like:zip://path/to/zipfile#path/in/zipfile@kkaefer is that OK?
ljbade commentedon Nov 17, 2014
OK that will not work with relative files, instead I will just use
asset://path/to/filewhich means we will load from the APK's assets dir.ljbade commentedon Nov 17, 2014
Implemented
asset://URLs in f0e4e27Now I need to get curl to load ca-bundle from memory. See http://curl.haxx.se/libcurl/c/cacertinmem.html and http://blog.steffenl.com/2013/02/load-certificate-from-memory-using-curl.html
ljbade commentedon Nov 17, 2014
Implemented loading CA bundle from memory: 80be6c4
I removed Assetbridge now that we no longer need it.
Done.
kkaefer commentedon Nov 24, 2014
+1 on
asset://URLs. Why make it Android-specific though? This will make stylesheets that use that URL scheme platform specific. Instead, we could use this scheme to provide a couple of default styles/sprites/fonts that always ship with all applications.I refrained from implementing the certificate loading from memory since it requires OpenSSL headers, which we don't necessarily have available on all platform, and I didn't want to add a direct dependency on it, as compiling OpenSSL can get quite hairy.
ljbade commentedon Nov 24, 2014
Just discovered that Android actually has a native version of the AssetManager in <android/asset_manager.h> so I might be able to get rid of libzip. Reopening.
@kkaefer no specific reason for it to be Android specific. I can refactor it to allow other platforms to implement it.
Interesting about OpenSSL headers. Perhaps we can just make it an
#ifdefthat is set on platforms that have OpenSSL headers and want to load certs fromasset://?@springmeyer was looking at switching from OpenSSL to Google's BoringSSL fork at least for Android. This is needed as OpenSSL has a compile bug on ARM Android that Google patched in their fork.
11 remaining items
ljbade commentedon Dec 2, 2014
@incanus I renamed the issue, is that better?
Anyway this issue was more about the Android implementation of
asset://, but that has now grown to cross-platform concept.Now Android is done with asset URL we should close this and have seperate tickets for asset support on other platforms?
incanus commentedon Dec 2, 2014
Nah let's do this since it's a single issue thing now:
kkaefer commentedon Dec 5, 2014
I think we should merge
FileRequestandAssetRequest, and move the actual implementation to a platform-specific file, like HTTPRequest already does (it uses Cocoa stuff on OS X/iOS, and CURL on all other platforms).FileRequestandAssetRequestare already very similar: relative paths in afile://URLS are relative to the executable or bundle (iOS/OS X), which means they are already used to access "bundled" files like the stylesheet or image sprites.jfirebaugh commentedon Dec 5, 2014
👍
mikemorris commentedon Dec 5, 2014
👍 to merging into
FileRequestwith platform-specific implementationsljbade commentedon Dec 6, 2014
Okay will work on this then.
Make file request overridable by platform implementations
change file:// to asset:// to indicate that they aren't arbitrary files
kkaefer commentedon Dec 17, 2014
@ljbade merged this. You can now move the Android implementation to the new scheme.
ljbade commentedon Dec 17, 2014
@kkaefer awesome
ljbade commentedon Jan 27, 2015
@kkaefer So where did this get to? I think Android was done right?
kkaefer commentedon Jan 27, 2015
This is implemented in other systems as well. OS X and iPhone bundles load data from the resources folder, Linux builds well load assets relative to the binary's location