1- use std:: { env, fs, path:: Path } ;
1+ use std:: { env, fs, path:: Path } ;
22
3- use crate :: { error, info, r#type :: Type , success, Res , util:: install_version} ;
3+ use crate :: { branch :: DiscordBranch , error, info, success, util:: install_version, Res } ;
44
5- pub async fn install ( release_type : Type , verbose : bool , open_asar : bool ) -> Res < ( ) > {
5+ pub async fn install ( release_type : DiscordBranch , verbose : bool , open_asar : bool ) -> Res < ( ) > {
66 // create user var & create .dvm dirs
77 let user = env:: var ( "USER" ) ?;
88 fs:: create_dir_all ( format ! ( "/home/{}/.dvm/bin" , user) ) ?;
@@ -11,10 +11,10 @@ pub async fn install(release_type: Type, verbose: bool, open_asar: bool) -> Res<
1111 }
1212
1313 let pascal_pkg = match release_type {
14- Type :: STABLE => "Discord" ,
15- Type :: PTB => "DiscordPTB" ,
16- Type :: CANARY => "DiscordCanary" ,
17- Type :: DEVELOPMENT => "DiscordDevelopment" ,
14+ DiscordBranch :: STABLE => "Discord" ,
15+ DiscordBranch :: PTB => "DiscordPTB" ,
16+ DiscordBranch :: CANARY => "DiscordCanary" ,
17+ DiscordBranch :: DEVELOPMENT => "DiscordDevelopment" ,
1818 } ;
1919
2020 let exists = Path :: new ( & format ! ( "/home/{}/.dvm/{}" , & user, & pascal_pkg) ) . exists ( ) ;
@@ -31,10 +31,11 @@ pub async fn install(release_type: Type, verbose: bool, open_asar: bool) -> Res<
3131 fs:: rename ( & asar_file, format ! ( "{}.bak" , & asar_file) ) ?;
3232 info ! ( "renamed app.asar to app.asar.bak (if discord doesn't work after this, rename it back)" ) ;
3333
34- let res = reqwest:: get ( "https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar" )
35- . await ?
36- . bytes ( )
37- . await ?;
34+ let res =
35+ reqwest:: get ( "https://github.com/GooseMod/OpenAsar/releases/download/nightly/app.asar" )
36+ . await ?
37+ . bytes ( )
38+ . await ?;
3839
3940 fs:: write ( & asar_file, res) ?;
4041
0 commit comments