@@ -97,7 +97,7 @@ fn main() {
97
97
98
98
#[ tauri:: command]
99
99
/// Wrapper for `find_game_install_location` as tauri doesn't allow passing `Result<>` types to front-end
100
- fn find_game_install_location_caller ( ) -> Result < GameInstall , String > {
100
+ async fn find_game_install_location_caller ( ) -> Result < GameInstall , String > {
101
101
match find_game_install_location ( ) {
102
102
Ok ( game_install) => Ok ( game_install) ,
103
103
Err ( err) => {
@@ -109,19 +109,20 @@ fn find_game_install_location_caller() -> Result<GameInstall, String> {
109
109
110
110
#[ tauri:: command]
111
111
/// This function's only use is to force a `panic!()`
112
+ // This must NOT be async to ensure crashing whole application.
112
113
fn force_panic ( ) {
113
114
panic ! ( "Force panicked!" ) ;
114
115
}
115
116
116
117
#[ tauri:: command]
117
118
/// Returns true if built in debug mode
118
- fn is_debug_mode ( ) -> bool {
119
+ async fn is_debug_mode ( ) -> bool {
119
120
return cfg ! ( debug_assertions) ;
120
121
}
121
122
122
123
#[ tauri:: command]
123
124
/// Returns true if linux compatible
124
- fn linux_checks ( ) -> Result < ( ) , String > {
125
+ async fn linux_checks ( ) -> Result < ( ) , String > {
125
126
// Early return if Windows
126
127
if get_host_os ( ) == "windows" {
127
128
return Err ( "Not available on Windows" . to_string ( ) ) ;
@@ -132,7 +133,7 @@ fn linux_checks() -> Result<(), String> {
132
133
133
134
#[ tauri:: command]
134
135
/// Returns the current version number as a string
135
- fn get_flightcore_version_number ( ) -> String {
136
+ async fn get_flightcore_version_number ( ) -> String {
136
137
let version = env ! ( "CARGO_PKG_VERSION" ) ;
137
138
if cfg ! ( debug_assertions) {
138
139
// Debugging enabled
@@ -144,7 +145,7 @@ fn get_flightcore_version_number() -> String {
144
145
}
145
146
146
147
#[ tauri:: command]
147
- fn get_northstar_version_number_caller ( game_path : String ) -> String {
148
+ async fn get_northstar_version_number_caller ( game_path : String ) -> String {
148
149
match get_northstar_version_number ( game_path) {
149
150
Ok ( version_number) => version_number,
150
151
Err ( err) => {
@@ -207,13 +208,13 @@ async fn check_is_northstar_outdated(
207
208
/// Checks if installed FlightCore version is up-to-date
208
209
/// false -> FlightCore install is up-to-date
209
210
/// true -> FlightCore install is outdated
210
- fn check_is_flightcore_outdated_caller ( ) -> Result < bool , String > {
211
+ async fn check_is_flightcore_outdated_caller ( ) -> Result < bool , String > {
211
212
check_is_flightcore_outdated ( )
212
213
}
213
214
214
215
#[ tauri:: command]
215
216
/// Checks if is valid Titanfall2 install based on certain conditions
216
- fn verify_install_location ( game_path : String ) -> bool {
217
+ async fn verify_install_location ( game_path : String ) -> bool {
217
218
match check_is_valid_game_path ( & game_path) {
218
219
Ok ( ( ) ) => true ,
219
220
Err ( err) => {
@@ -225,7 +226,7 @@ fn verify_install_location(game_path: String) -> bool {
225
226
226
227
#[ tauri:: command]
227
228
/// Returns identifier of host OS FlightCore is running on
228
- fn get_host_os_caller ( ) -> String {
229
+ async fn get_host_os_caller ( ) -> String {
229
230
get_host_os ( )
230
231
}
231
232
@@ -265,28 +266,28 @@ async fn update_northstar_caller(
265
266
266
267
#[ tauri:: command]
267
268
/// Launches Northstar
268
- fn launch_northstar_caller ( game_install : GameInstall ) -> Result < String , String > {
269
+ async fn launch_northstar_caller ( game_install : GameInstall ) -> Result < String , String > {
269
270
launch_northstar ( game_install)
270
271
}
271
272
272
273
#[ tauri:: command]
273
274
/// Get list of Northstar logs
274
- fn get_log_list_caller ( game_install : GameInstall ) -> Result < Vec < std:: path:: PathBuf > , String > {
275
+ async fn get_log_list_caller ( game_install : GameInstall ) -> Result < Vec < std:: path:: PathBuf > , String > {
275
276
get_log_list ( game_install)
276
277
}
277
278
278
279
#[ tauri:: command]
279
- fn verify_game_files_caller ( game_install : GameInstall ) -> Result < String , String > {
280
+ async fn verify_game_files_caller ( game_install : GameInstall ) -> Result < String , String > {
280
281
verify_game_files ( game_install)
281
282
}
282
283
283
284
#[ tauri:: command]
284
- fn get_enabled_mods_caller ( game_install : GameInstall ) -> Result < serde_json:: value:: Value , String > {
285
+ async fn get_enabled_mods_caller ( game_install : GameInstall ) -> Result < serde_json:: value:: Value , String > {
285
286
get_enabled_mods ( game_install)
286
287
}
287
288
288
289
#[ tauri:: command]
289
- fn set_mod_enabled_status_caller (
290
+ async fn set_mod_enabled_status_caller (
290
291
game_install : GameInstall ,
291
292
mod_name : String ,
292
293
is_enabled : bool ,
@@ -295,7 +296,7 @@ fn set_mod_enabled_status_caller(
295
296
}
296
297
297
298
#[ tauri:: command]
298
- fn disable_all_but_core_caller ( game_install : GameInstall ) -> Result < ( ) , String > {
299
+ async fn disable_all_but_core_caller ( game_install : GameInstall ) -> Result < ( ) , String > {
299
300
disable_all_but_core ( game_install)
300
301
}
301
302
0 commit comments