@@ -351,22 +351,26 @@ fn resource_dir_from<P: AsRef<std::path::Path>>(
351
351
#[ no_mangle]
352
352
#[ cfg_attr( not( target_vendor = "apple" ) , link_section = ".taubndl" ) ]
353
353
#[ cfg_attr( target_vendor = "apple" , link_section = "__DATA,taubndl" ) ]
354
- static __TAURI_BUNDLE_TYPE: & str = "UNK" ;
354
+ // Marked as `mut` becuase it could get optimized away without it,
355
+ // see https://github.com/tauri-apps/tauri/pull/13812
356
+ static mut __TAURI_BUNDLE_TYPE: & str = "UNK" ;
355
357
356
358
/// Get the type of the bundle current binary is packaged in.
357
359
/// If the bundle type is unknown, it returns [`Option::None`].
358
360
pub fn bundle_type ( ) -> Option < BundleType > {
359
- match __TAURI_BUNDLE_TYPE {
360
- "DEB" => Some ( BundleType :: Deb ) ,
361
- "RPM" => Some ( BundleType :: Rpm ) ,
362
- "APP" => Some ( BundleType :: AppImage ) ,
363
- "MSI" => Some ( BundleType :: Msi ) ,
364
- "NSS" => Some ( BundleType :: Nsis ) ,
365
- _ => {
366
- if cfg ! ( target_os = "macos" ) {
367
- Some ( BundleType :: App )
368
- } else {
369
- None
361
+ unsafe {
362
+ match __TAURI_BUNDLE_TYPE {
363
+ "DEB" => Some ( BundleType :: Deb ) ,
364
+ "RPM" => Some ( BundleType :: Rpm ) ,
365
+ "APP" => Some ( BundleType :: AppImage ) ,
366
+ "MSI" => Some ( BundleType :: Msi ) ,
367
+ "NSS" => Some ( BundleType :: Nsis ) ,
368
+ _ => {
369
+ if cfg ! ( target_os = "macos" ) {
370
+ Some ( BundleType :: App )
371
+ } else {
372
+ None
373
+ }
370
374
}
371
375
}
372
376
}
0 commit comments