More fixes

This commit is contained in:
Luke Street 2022-09-11 20:45:27 -04:00
parent 7bcbfd7bc0
commit d5e157545d
3 changed files with 20 additions and 11 deletions

View File

@ -200,12 +200,14 @@ impl eframe::App for App {
// Windows + request_repaint_after breaks dialogs:
// https://github.com/emilk/egui/issues/2003
if cfg!(windows) || view_state.jobs.iter().any(|job| {
if let Some(handle) = &job.handle {
return !handle.is_finished();
}
false
}) {
if cfg!(windows)
|| view_state.jobs.iter().any(|job| {
if let Some(handle) = &job.handle {
return !handle.is_finished();
}
false
})
{
ctx.request_repaint();
} else {
ctx.request_repaint_after(Duration::from_millis(100));

View File

@ -30,15 +30,16 @@ fn run_make(cwd: &Path, arg: &Path, config: &AppConfig) -> BuildStatus {
match (|| -> Result<BuildStatus> {
let make = if config.custom_make.is_empty() { "make" } else { &config.custom_make };
#[cfg(not(windows))]
{
let mut command = {
let mut command = Command::new(make);
command.current_dir(cwd).arg(arg);
command
}
};
#[cfg(windows)]
let mut command = {
use path_slash::PathExt;
use std::os::windows::process::CommandExt;
use path_slash::PathExt;
let mut command = if config.selected_wsl_distro.is_some() {
Command::new("wsl")
} else {

View File

@ -1,7 +1,8 @@
use std::process::Command;
#[cfg(windows)]
use std::string::FromUtf16Error;
use std::sync::{Arc, RwLock};
#[cfg(windows)]
use anyhow::{Context, Result};
use crate::{
@ -20,7 +21,7 @@ fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> {
#[cfg(windows)]
fn wsl_cmd(args: &[&str]) -> Result<String> {
use std::os::windows::process::CommandExt;
use std::{os::windows::process::CommandExt, process::Command};
let output = Command::new("wsl")
.args(args)
.creation_flags(winapi::um::winbase::CREATE_NO_WINDOW)
@ -73,6 +74,11 @@ pub fn config_ui(ui: &mut egui::Ui, config: &Arc<RwLock<AppConfig>>, view_state:
}
});
}
#[cfg(not(windows))]
{
let _ = available_wsl_distros;
let _ = selected_wsl_distro;
}
ui.label("Custom make program:");
ui.text_edit_singleline(custom_make);