@@ -23,7 +23,6 @@ async fn download_module(url: &str) -> Result<(), Box<dyn std::error::Error>> {
23
23
while let Some ( chunk) = response. chunk ( ) . await ? {
24
24
file. write_all ( & chunk) ?;
25
25
}
26
- // TODO: testing check if it matches correctly
27
26
let tar_regex = Regex :: new ( r"(?i)\.tar(?:\.gz)?$" ) . unwrap ( ) ;
28
27
if file_name. ends_with ( ".zip" ) {
29
28
let output = std:: process:: Command :: new ( "unzip" )
@@ -94,18 +93,10 @@ pub(crate) async fn download_modules() -> Result<(), Box<dyn std::error::Error>>
94
93
Ok ( ( ) )
95
94
}
96
95
96
+ #[ cfg( target_os = "linux" ) ]
97
97
pub ( crate ) fn has_essential_modules ( modules : Vec < String > ) -> bool {
98
- // TODO: confirm that windows and mac the watchers are separate and not in the same module
99
-
100
- let essential_modules = if cfg ! ( target_os = "linux" ) {
101
- if is_wayland ( ) {
102
- vec ! [ "aw-awatcher" . to_string( ) ]
103
- } else {
104
- vec ! [
105
- "aw-watcher-afk" . to_string( ) ,
106
- "aw-watcher-window" . to_string( ) ,
107
- ]
108
- }
98
+ let essential_modules = if is_wayland ( ) {
99
+ vec ! [ "aw-awatcher" . to_string( ) ]
109
100
} else {
110
101
vec ! [
111
102
"aw-watcher-afk" . to_string( ) ,
@@ -120,3 +111,18 @@ pub(crate) fn has_essential_modules(modules: Vec<String>) -> bool {
120
111
}
121
112
true
122
113
}
114
+
115
+ #[ cfg( not( any( target_os = "linux" ) ) ) ]
116
+ pub ( crate ) fn has_essential_modules ( modules : Vec < String > ) -> bool {
117
+ let essential_modules = vec ! [
118
+ "aw-watcher-afk" . to_string( ) ,
119
+ "aw-watcher-window" . to_string( ) ,
120
+ ] ;
121
+
122
+ for module in essential_modules {
123
+ if !modules. iter ( ) . any ( |m| m == & module) {
124
+ return false ;
125
+ }
126
+ }
127
+ true
128
+ }
0 commit comments