@@ -296,13 +296,13 @@ impl UpdaterBuilder {
296
296
return Err ( Error :: EmptyEndpoints ) ;
297
297
} ;
298
298
299
- let arch = get_updater_arch ( ) . ok_or ( Error :: UnsupportedArch ) ?;
299
+ let arch = updater_arch ( ) . ok_or ( Error :: UnsupportedArch ) ?;
300
300
let ( target, json_target) = if let Some ( target) = self . target {
301
301
( target. clone ( ) , target)
302
302
} else {
303
- let target = get_updater_target ( ) . ok_or ( Error :: UnsupportedOs ) ?;
304
- let json_target = format ! ( "{target }-{arch}" ) ;
305
- ( target . to_owned ( ) , json_target)
303
+ let os = updater_os ( ) . ok_or ( Error :: UnsupportedOs ) ?;
304
+ let json_target = format ! ( "{os }-{arch}" ) ;
305
+ ( os . to_owned ( ) , json_target)
306
306
} ;
307
307
308
308
let executable_path = self . executable_path . clone ( ) . unwrap_or ( current_exe ( ) ?) ;
@@ -359,7 +359,8 @@ pub struct Updater {
359
359
proxy : Option < Url > ,
360
360
endpoints : Vec < Url > ,
361
361
arch : & ' static str ,
362
- // The `{{target}}` variable we replace in the endpoint and serach for in the JSON
362
+ // The `{{target}}` variable we replace in the endpoint and serach for in the JSON,
363
+ // this is either the user provided target or the current operating system by default
363
364
target : String ,
364
365
// The value we search if the updater server returns a JSON with the `platforms` object
365
366
json_target : String ,
@@ -375,15 +376,15 @@ pub struct Updater {
375
376
376
377
impl Updater {
377
378
fn get_updater_installer ( & self ) -> Option < Installer > {
378
- bundle_type ( ) . and_then ( |t| match t {
379
+ match bundle_type ( ) ? {
379
380
BundleType :: Deb => Some ( Installer :: Deb ) ,
380
381
BundleType :: Rpm => Some ( Installer :: Rpm ) ,
381
382
BundleType :: AppImage => Some ( Installer :: AppImage ) ,
382
383
BundleType :: Msi => Some ( Installer :: Msi ) ,
383
384
BundleType :: Nsis => Some ( Installer :: Nsis ) ,
384
385
BundleType :: App => Some ( Installer :: App ) ,
385
386
BundleType :: Dmg => None ,
386
- } )
387
+ }
387
388
}
388
389
389
390
pub async fn check ( & self ) -> Result < Option < Update > > {
@@ -518,7 +519,7 @@ impl Updater {
518
519
if let Some ( installer) = installer {
519
520
let target = & format ! ( "{}-{}" , & self . json_target, installer. suffix( ) ) ;
520
521
log:: debug!(
521
- "Bundle type is {}. Checking for plattform {target} in response" ,
522
+ "Bundle type is {}. Checking for platform {target} in response" ,
522
523
installer. suffix( )
523
524
) ;
524
525
let bundle_url = release. download_url ( target) ;
@@ -530,9 +531,9 @@ impl Updater {
530
531
target. clone ( ) ,
531
532
) ) ;
532
533
}
533
- log:: debug!( "Plattform {target} not found in response. Using fallback URL" ) ;
534
+ log:: debug!( "Platform {target} not found in response. Using fallback URL" ) ;
534
535
} else {
535
- log:: debug!( "Plattform {target} found in response" ) ;
536
+ log:: debug!( "Platform {target} found in response" ) ;
536
537
download_url = bundle_url;
537
538
signature = bundle_signature;
538
539
}
@@ -1275,14 +1276,14 @@ impl Update {
1275
1276
1276
1277
/// Gets the target string used on the updater.
1277
1278
pub fn target ( ) -> Option < String > {
1278
- if let ( Some ( target) , Some ( arch) ) = ( get_updater_target ( ) , get_updater_arch ( ) ) {
1279
+ if let ( Some ( target) , Some ( arch) ) = ( updater_os ( ) , updater_arch ( ) ) {
1279
1280
Some ( format ! ( "{target}-{arch}" ) )
1280
1281
} else {
1281
1282
None
1282
1283
}
1283
1284
}
1284
1285
1285
- pub ( crate ) fn get_updater_target ( ) -> Option < & ' static str > {
1286
+ fn updater_os ( ) -> Option < & ' static str > {
1286
1287
if cfg ! ( target_os = "linux" ) {
1287
1288
Some ( "linux" )
1288
1289
} else if cfg ! ( target_os = "macos" ) {
@@ -1295,7 +1296,7 @@ pub(crate) fn get_updater_target() -> Option<&'static str> {
1295
1296
}
1296
1297
}
1297
1298
1298
- pub ( crate ) fn get_updater_arch ( ) -> Option < & ' static str > {
1299
+ fn updater_arch ( ) -> Option < & ' static str > {
1299
1300
if cfg ! ( target_arch = "x86" ) {
1300
1301
Some ( "i686" )
1301
1302
} else if cfg ! ( target_arch = "x86_64" ) {
0 commit comments