From 0c102146685ad0707ddb7e2f8ea1166782c1e76d Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 11 Jan 2023 22:59:03 -0500 Subject: build-command setting + a bunch of config fixes - now we only show the first config error - path matching is now ranked more highly than language matching - paths with forward slashes are now handled for Windows path-specific settings --- build.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'build.c') diff --git a/build.c b/build.c index dc15144..0311b09 100644 --- a/build.c +++ b/build.c @@ -86,26 +86,29 @@ void build_start_with_command(Ted *ted, const char *command) { void build_start(Ted *ted) { Settings *settings = ted_active_settings(ted); - char *command = settings->build_default_command; + char *command = settings->build_command; char *root = ted_get_root_dir(ted); strbuf_cpy(ted->build_dir, root); - change_directory(root); - free(root); - -#if _WIN32 - if (fs_file_exists("make.bat")) { - command = "make.bat"; - } else -#endif - if (fs_file_exists("Cargo.toml")) { - command = "cargo build"; - } else if (fs_file_exists("Makefile")) { - command = "make -j12"; - } else if (fs_file_exists("go.mod")) { - command = "go build"; - } + if (*command == 0) { + command = settings->build_default_command; + change_directory(root); - build_start_with_command(ted, command); + #if _WIN32 + if (fs_file_exists("make.bat")) { + command = "make.bat"; + } else + #endif + if (fs_file_exists("Cargo.toml")) { + command = "cargo build"; + } else if (fs_file_exists("Makefile")) { + command = "make -j16"; + } else if (fs_file_exists("go.mod")) { + command = "go build"; + } + } + free(root); + if (*command) + build_start_with_command(ted, command); } static void build_go_to_error(Ted *ted) { -- cgit v1.2.3