@@ -95,29 +95,47 @@ impl<B: Bundle + ?Sized> Bundle for Box<B> {
9595 }
9696}
9797
98- /// The URL of the default bundle.
98+ /// Get the URL of the default bundle.
9999///
100- /// This is a hardcoded URL of a default bundle that will provide some
100+ /// This is a mostly- hardcoded URL of a default bundle that will provide some
101101/// "sensible" set of TeX support files. The higher-level `tectonic` crate
102102/// provides a configuration mechanism to allow the user to override this
103103/// setting, so you should use that if you are in a position to do so.
104104///
105- /// This URL will be embedded in the binaries that you create, which may be used
106- /// for years into the future, so it needs to be durable and reliable. We used
107- /// `archive.org` for a while, but it had low-level reliability problems and was
108- /// blocked in China. We now use a custom webservice.
109- pub const FALLBACK_BUNDLE_URL : & str = "https://relay.fullyjustified.net/default_bundle.tar" ;
105+ /// The URL depends on the format version supported by the engine, since that
106+ /// roughly corresponds to a TeXLive version, and the engine and TeXLive files
107+ /// are fairly closely coupled.
108+ ///
109+ /// The URL template used in this function will be embedded in the binaries that
110+ /// you create, which may be used for years into the future, so it needs to be
111+ /// durable and reliable. We used `archive.org` for a while, but it had
112+ /// low-level reliability problems and was blocked in China. We now use a custom
113+ /// webservice.
114+ pub fn get_fallback_bundle_url ( format_version : u32 ) -> String {
115+ // Format version 32 (TeXLive 2021) was when we introduced versioning to the
116+ // URL.
117+ if format_version < 32 {
118+ "https://relay.fullyjustified.net/default_bundle.tar" . to_owned ( )
119+ } else {
120+ format ! (
121+ "https://relay.fullyjustified.net/default_bundle_v{}.tar" ,
122+ format_version
123+ )
124+ }
125+ }
110126
111127/// Open the fallback bundle.
112128///
113129/// This is essentially the default Tectonic bundle, but the higher-level
114130/// `tectonic` crate provides a configuration mechanism to allow the user to
115- /// override the [`FALLBACK_BUNDLE_URL`] setting, and that should be preferred
116- /// if you’re in a position to use it.
131+ /// override the bundle URL setting, and that should be preferred if you’re in a
132+ /// position to use it.
117133pub fn get_fallback_bundle (
134+ format_version : u32 ,
118135 only_cached : bool ,
119136 status : & mut dyn StatusBackend ,
120137) -> Result < cache:: CachingBundle < itar:: IndexedTarBackend > > {
138+ let url = get_fallback_bundle_url ( format_version) ;
121139 let mut cache = cache:: Cache :: get_user_default ( ) ?;
122- cache. open ( FALLBACK_BUNDLE_URL , only_cached, status)
140+ cache. open ( & url , only_cached, status)
123141}
0 commit comments