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