mirror of https://github.com/encounter/objdiff.git
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.
This commit is contained in:
parent
261e1b8e07
commit
b900ae5a00
|
@ -20,6 +20,7 @@ strip = "debuginfo"
|
|||
[features]
|
||||
default = []
|
||||
wgpu = ["eframe/wgpu"]
|
||||
wsl = []
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
use std::string::FromUtf16Error;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
|
@ -6,7 +6,7 @@ use std::{
|
|||
path::{PathBuf, MAIN_SEPARATOR},
|
||||
};
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
use anyhow::{Context, Result};
|
||||
use const_format::formatcp;
|
||||
use egui::{
|
||||
|
@ -43,7 +43,7 @@ pub struct ConfigViewState {
|
|||
pub object_search: String,
|
||||
pub filter_diffable: bool,
|
||||
pub filter_incomplete: bool,
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
pub available_wsl_distros: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ pub const DEFAULT_WATCH_PATTERNS: &[&str] = &[
|
|||
"*.inc", "*.py", "*.yml", "*.txt", "*.json",
|
||||
];
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
|
||||
let u16_bytes: Vec<u16> = bytes
|
||||
.chunks_exact(2)
|
||||
|
@ -96,7 +96,7 @@ fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
|
|||
String::from_utf16(&u16_bytes)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
fn wsl_cmd(args: &[&str]) -> Result<String> {
|
||||
use std::{os::windows::process::CommandExt, process::Command};
|
||||
let output = Command::new("wsl")
|
||||
|
@ -107,7 +107,7 @@ fn wsl_cmd(args: &[&str]) -> Result<String> {
|
|||
process_utf16(&output.stdout).context("Failed to process stdout")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
fn fetch_wsl2_distros() -> Vec<String> {
|
||||
wsl_cmd(&["-l", "-q"])
|
||||
.map(|stdout| {
|
||||
|
@ -180,7 +180,7 @@ pub fn config_ui(
|
|||
}
|
||||
ui.separator();
|
||||
|
||||
#[cfg(windows)]
|
||||
#[cfg(feature = "wsl")]
|
||||
{
|
||||
ui.heading("Build");
|
||||
if state.available_wsl_distros.is_none() {
|
||||
|
@ -196,7 +196,7 @@ pub fn config_ui(
|
|||
});
|
||||
ui.separator();
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
#[cfg(not(feature = "wsl"))]
|
||||
{
|
||||
let _ = selected_wsl_distro;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue