1
- #[ cfg( windows ) ]
1
+ #[ cfg( feature = "wsl" ) ]
2
2
use std:: string:: FromUtf16Error ;
3
3
use std:: {
4
4
borrow:: Cow ,
5
5
mem:: take,
6
6
path:: { PathBuf , MAIN_SEPARATOR } ,
7
7
} ;
8
8
9
- #[ cfg( windows ) ]
9
+ #[ cfg( feature = "wsl" ) ]
10
10
use anyhow:: { Context , Result } ;
11
11
use const_format:: formatcp;
12
12
use egui:: {
@@ -43,7 +43,7 @@ pub struct ConfigViewState {
43
43
pub object_search : String ,
44
44
pub filter_diffable : bool ,
45
45
pub filter_incomplete : bool ,
46
- #[ cfg( windows ) ]
46
+ #[ cfg( feature = "wsl" ) ]
47
47
pub available_wsl_distros : Option < Vec < String > > ,
48
48
}
49
49
@@ -87,7 +87,7 @@ pub const DEFAULT_WATCH_PATTERNS: &[&str] = &[
87
87
"*.inc" , "*.py" , "*.yml" , "*.txt" , "*.json" ,
88
88
] ;
89
89
90
- #[ cfg( windows ) ]
90
+ #[ cfg( feature = "wsl" ) ]
91
91
fn process_utf16 ( bytes : & [ u8 ] ) -> Result < String , FromUtf16Error > {
92
92
let u16_bytes: Vec < u16 > = bytes
93
93
. chunks_exact ( 2 )
@@ -96,7 +96,7 @@ fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
96
96
String :: from_utf16 ( & u16_bytes)
97
97
}
98
98
99
- #[ cfg( windows ) ]
99
+ #[ cfg( feature = "wsl" ) ]
100
100
fn wsl_cmd ( args : & [ & str ] ) -> Result < String > {
101
101
use std:: { os:: windows:: process:: CommandExt , process:: Command } ;
102
102
let output = Command :: new ( "wsl" )
@@ -107,7 +107,7 @@ fn wsl_cmd(args: &[&str]) -> Result<String> {
107
107
process_utf16 ( & output. stdout ) . context ( "Failed to process stdout" )
108
108
}
109
109
110
- #[ cfg( windows ) ]
110
+ #[ cfg( feature = "wsl" ) ]
111
111
fn fetch_wsl2_distros ( ) -> Vec < String > {
112
112
wsl_cmd ( & [ "-l" , "-q" ] )
113
113
. map ( |stdout| {
@@ -180,7 +180,7 @@ pub fn config_ui(
180
180
}
181
181
ui. separator ( ) ;
182
182
183
- #[ cfg( windows ) ]
183
+ #[ cfg( feature = "wsl" ) ]
184
184
{
185
185
ui. heading ( "Build" ) ;
186
186
if state. available_wsl_distros . is_none ( ) {
@@ -196,7 +196,7 @@ pub fn config_ui(
196
196
} ) ;
197
197
ui. separator ( ) ;
198
198
}
199
- #[ cfg( not( windows ) ) ]
199
+ #[ cfg( not( feature = "wsl" ) ) ]
200
200
{
201
201
let _ = selected_wsl_distro;
202
202
}
0 commit comments