Skip to content

Commit b900ae5

Browse files
committed
Disable WSL integration
With WSL, objdiff is unable to get filesystem notifications. It's recommended to run objdiff natively on Windows, so having this option is more confusing than useful.
1 parent 261e1b8 commit b900ae5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ strip = "debuginfo"
2020
[features]
2121
default = []
2222
wgpu = ["eframe/wgpu"]
23+
wsl = []
2324

2425
[dependencies]
2526
anyhow = "1.0.75"

src/views/config.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#[cfg(windows)]
1+
#[cfg(feature = "wsl")]
22
use std::string::FromUtf16Error;
33
use std::{
44
borrow::Cow,
55
mem::take,
66
path::{PathBuf, MAIN_SEPARATOR},
77
};
88

9-
#[cfg(windows)]
9+
#[cfg(feature = "wsl")]
1010
use anyhow::{Context, Result};
1111
use const_format::formatcp;
1212
use egui::{
@@ -43,7 +43,7 @@ pub struct ConfigViewState {
4343
pub object_search: String,
4444
pub filter_diffable: bool,
4545
pub filter_incomplete: bool,
46-
#[cfg(windows)]
46+
#[cfg(feature = "wsl")]
4747
pub available_wsl_distros: Option<Vec<String>>,
4848
}
4949

@@ -87,7 +87,7 @@ pub const DEFAULT_WATCH_PATTERNS: &[&str] = &[
8787
"*.inc", "*.py", "*.yml", "*.txt", "*.json",
8888
];
8989

90-
#[cfg(windows)]
90+
#[cfg(feature = "wsl")]
9191
fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
9292
let u16_bytes: Vec<u16> = bytes
9393
.chunks_exact(2)
@@ -96,7 +96,7 @@ fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
9696
String::from_utf16(&u16_bytes)
9797
}
9898

99-
#[cfg(windows)]
99+
#[cfg(feature = "wsl")]
100100
fn wsl_cmd(args: &[&str]) -> Result<String> {
101101
use std::{os::windows::process::CommandExt, process::Command};
102102
let output = Command::new("wsl")
@@ -107,7 +107,7 @@ fn wsl_cmd(args: &[&str]) -> Result<String> {
107107
process_utf16(&output.stdout).context("Failed to process stdout")
108108
}
109109

110-
#[cfg(windows)]
110+
#[cfg(feature = "wsl")]
111111
fn fetch_wsl2_distros() -> Vec<String> {
112112
wsl_cmd(&["-l", "-q"])
113113
.map(|stdout| {
@@ -180,7 +180,7 @@ pub fn config_ui(
180180
}
181181
ui.separator();
182182

183-
#[cfg(windows)]
183+
#[cfg(feature = "wsl")]
184184
{
185185
ui.heading("Build");
186186
if state.available_wsl_distros.is_none() {
@@ -196,7 +196,7 @@ pub fn config_ui(
196196
});
197197
ui.separator();
198198
}
199-
#[cfg(not(windows))]
199+
#[cfg(not(feature = "wsl"))]
200200
{
201201
let _ = selected_wsl_distro;
202202
}

0 commit comments

Comments
 (0)