From 7bf9752200e70b298b843668fd48f8978fc0de36 Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 8 Sep 2020 11:22:17 +0200 Subject: [PATCH] Added colors to terminal warnings and errors --- src/cmake.cpp | 4 ++-- src/config.cpp | 2 +- src/directories.cpp | 22 ++++++++++----------- src/juci.cpp | 4 ++-- src/meson.cpp | 4 ++-- src/notebook.cpp | 4 ++-- src/project.cpp | 16 +++++++-------- src/snippets.cpp | 4 ++-- src/source.cpp | 8 ++++---- src/source_base.cpp | 6 +++--- src/source_clang.cpp | 6 +++--- src/source_generic.cpp | 2 +- src/source_language_protocol.cpp | 2 +- src/terminal.cpp | 6 +++--- src/window.cpp | 34 ++++++++++++++++---------------- 15 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/cmake.cpp b/src/cmake.cpp index 41c6b36..8d11a1b 100644 --- a/src/cmake.cpp +++ b/src/cmake.cpp @@ -51,7 +51,7 @@ bool CMake::update_default_build(const boost::filesystem::path &default_build_pa boost::system::error_code ec; boost::filesystem::create_directories(default_build_path, ec); if(ec) { - Terminal::get().print("Error: could not create " + default_build_path.string() + ": " + ec.message() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + default_build_path.string() + ": " + ec.message() + "\n", true); return false; } } @@ -112,7 +112,7 @@ bool CMake::update_debug_build(const boost::filesystem::path &debug_build_path, boost::system::error_code ec; boost::filesystem::create_directories(debug_build_path, ec); if(ec) { - Terminal::get().print("Error: could not create " + debug_build_path.string() + ": " + ec.message() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + debug_build_path.string() + ": " + ec.message() + "\n", true); return false; } } diff --git a/src/config.cpp b/src/config.cpp index b3df836..da9a25e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -44,7 +44,7 @@ void Config::load() { } catch(const std::exception &e) { dispatcher.post([config_json = std::move(config_json), e_what = std::string(e.what())] { - ::Terminal::get().print("Error: could not parse " + config_json.string() + ": " + e_what + "\n", true); + ::Terminal::get().print("\e[31mError\e[m: could not parse " + config_json.string() + ": " + e_what + "\n", true); }); std::stringstream ss; ss << default_config_file; diff --git a/src/directories.cpp b/src/directories.cpp index 29c06a0..d8353c0 100644 --- a/src/directories.cpp +++ b/src/directories.cpp @@ -56,7 +56,7 @@ bool Directories::TreeStore::drag_data_received_vfunc(const TreeModel::Path &pat boost::system::error_code ec; if(boost::filesystem::exists(target_path, ec)) { - Terminal::get().print("Error: could not move file: " + target_path.string() + " already exists\n", true); + Terminal::get().print("\e[31mError\e[m: could not move file: " + target_path.string() + " already exists\n", true); return false; } @@ -66,7 +66,7 @@ bool Directories::TreeStore::drag_data_received_vfunc(const TreeModel::Path &pat boost::filesystem::rename(source_path, target_path, ec); if(ec) { - Terminal::get().print("Error: could not move file: " + ec.message() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not move file: " + ec.message() + '\n', true); return false; } @@ -287,12 +287,12 @@ Directories::Directories() : Gtk::ListViewText(1) { on_save_file(target_path); } else { - Terminal::get().print("Error: could not create " + target_path.string() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not create " + target_path.string() + '\n', true); return; } } else { - Terminal::get().print("Error: could not create " + target_path.string() + ": already exists\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + target_path.string() + ": already exists\n", true); return; } @@ -331,12 +331,12 @@ Directories::Directories() : Gtk::ListViewText(1) { select(target_path); } else { - Terminal::get().print("Error: could not create " + target_path.string() + ": " + ec.message(), true); + Terminal::get().print("\e[31mError\e[m: could not create " + target_path.string() + ": " + ec.message(), true); return; } } else { - Terminal::get().print("Error: could not create " + target_path.string() + ": already exists\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + target_path.string() + ": already exists\n", true); return; } @@ -372,7 +372,7 @@ Directories::Directories() : Gtk::ListViewText(1) { auto target_path = source_path.parent_path() / content; if(boost::filesystem::exists(target_path, ec)) { - Terminal::get().print("Error: could not rename to " + target_path.string() + ": already exists\n", true); + Terminal::get().print("\e[31mError\e[m: could not rename to " + target_path.string() + ": already exists\n", true); return; } @@ -381,7 +381,7 @@ Directories::Directories() : Gtk::ListViewText(1) { boost::filesystem::rename(source_path, target_path, ec); if(ec) { - Terminal::get().print("Error: could not rename " + source_path.string() + ": " + ec.message() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not rename " + source_path.string() + ": " + ec.message() + '\n', true); return; } update(); @@ -412,7 +412,7 @@ Directories::Directories() : Gtk::ListViewText(1) { if(view->language) new_language_id = view->language->get_id(); if(new_language_id != old_language_id) - Terminal::get().print("Warning: language for " + target_path.string() + " has changed. Please reopen the file\n"); + Terminal::get().print("\e[33mWarning\e[m: language for " + target_path.string() + " has changed. Please reopen the file\n"); } } @@ -448,7 +448,7 @@ Directories::Directories() : Gtk::ListViewText(1) { boost::filesystem::remove_all(menu_popup_row_path, ec); if(ec) { - Terminal::get().print("Error: could not delete " + menu_popup_row_path.string() + ": " + ec.message() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not delete " + menu_popup_row_path.string() + ": " + ec.message() + "\n", true); return; } @@ -495,7 +495,7 @@ Directories::~Directories() { void Directories::open(const boost::filesystem::path &dir_path) { boost::system::error_code ec; if(dir_path.empty() || !boost::filesystem::is_directory(dir_path, ec)) { - Terminal::get().print("Error: could not open " + dir_path.string() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not open " + dir_path.string() + '\n', true); return; } diff --git a/src/juci.cpp b/src/juci.cpp index e3a081a..41d31f1 100644 --- a/src/juci.cpp +++ b/src/juci.cpp @@ -27,7 +27,7 @@ int Application::on_command_line(const Glib::RefPtr boost::system::error_code current_path_ec; auto current_path = boost::filesystem::current_path(current_path_ec); if(current_path_ec) - errors.emplace_back("Error: could not find current path\n"); + errors.emplace_back("\e[31mError\e[m: could not find current path\n"); for(int c = 1; c < argc; c++) { boost::filesystem::path path(argv[c]); if(path.is_relative() && !current_path_ec) @@ -44,7 +44,7 @@ int Application::on_command_line(const Glib::RefPtr if(path.is_absolute() && boost::filesystem::is_directory(path.parent_path(), ec)) files.emplace_back(path, 0); else - errors.emplace_back("Error: could not create " + path.string() + ".\n"); + errors.emplace_back("\e[31mError\e[m: could not create " + path.string() + ".\n"); } } } diff --git a/src/meson.cpp b/src/meson.cpp index 31e4bde..a85afb1 100644 --- a/src/meson.cpp +++ b/src/meson.cpp @@ -50,7 +50,7 @@ bool Meson::update_default_build(const boost::filesystem::path &default_build_pa boost::system::error_code ec; boost::filesystem::create_directories(default_build_path, ec); if(ec) { - Terminal::get().print("Error: could not create " + default_build_path.string() + ": " + ec.message() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + default_build_path.string() + ": " + ec.message() + "\n", true); return false; } } @@ -93,7 +93,7 @@ bool Meson::update_debug_build(const boost::filesystem::path &debug_build_path, boost::system::error_code ec; boost::filesystem::create_directories(debug_build_path, ec); if(ec) { - Terminal::get().print("Error: could not create " + debug_build_path.string() + ": " + ec.message() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not create " + debug_build_path.string() + ": " + ec.message() + "\n", true); return false; } } diff --git a/src/notebook.cpp b/src/notebook.cpp index e189e78..9e06364 100644 --- a/src/notebook.cpp +++ b/src/notebook.cpp @@ -117,7 +117,7 @@ bool Notebook::open(Source::View *view) { bool Notebook::open(const boost::filesystem::path &file_path_, Position position) { boost::system::error_code ec; if(file_path_.empty() || (boost::filesystem::exists(file_path_, ec) && !boost::filesystem::is_regular_file(file_path_, ec))) { - Terminal::get().print("Error: could not open " + file_path_.string() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not open " + file_path_.string() + "\n", true); return false; } @@ -147,7 +147,7 @@ bool Notebook::open(const boost::filesystem::path &file_path_, Position position if(boost::filesystem::exists(file_path, ec)) { std::ifstream can_read(file_path.string()); if(!can_read) { - Terminal::get().print("Error: could not open " + file_path.string() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not open " + file_path.string() + "\n", true); return false; } can_read.close(); diff --git a/src/project.cpp b/src/project.cpp index 588f4cd..ea1dc62 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -363,11 +363,11 @@ void Project::LLDB::debug_start() { *run_arguments = build->get_executable(view ? view->file_path : Directories::get().path).string(); if(run_arguments->empty()) { if(build->is_valid()) { - Terminal::get().print("Warning: could not find executable.\n"); - Terminal::get().print("Solution: either use Project Set Run Arguments, or open a source file within a directory where an executable is defined.\n"); + Terminal::get().print("\e[33mWarning\e[m: could not find executable.\n"); + Terminal::get().print("\e[32mSolution\e[m: either use Project Set Run Arguments, or open a source file within a directory where an executable is defined.\n"); } else - Terminal::get().print("Error: build folder no longer valid, please rebuild project.\n", true); + Terminal::get().print("\e[31mError\e[m: build folder no longer valid, please rebuild project.\n", true); return; } size_t pos = run_arguments->find(default_build_path.string()); @@ -875,11 +875,11 @@ void Project::Clang::compile_and_run() { auto executable = build->get_executable(view ? view->file_path : Directories::get().path); if(executable.empty()) { if(build->is_valid()) { - Terminal::get().print("Warning: could not find executable.\n"); - Terminal::get().print("Solution: either use Project Set Run Arguments, or open a source file within a directory where an executable is defined.\n"); + Terminal::get().print("\e[33mWarning\e[m: could not find executable.\n"); + Terminal::get().print("\e[32mSolution\e[m: either use Project Set Run Arguments, or open a source file within a directory where an executable is defined.\n"); } else - Terminal::get().print("Error: build folder no longer valid, please rebuild project.\n", true); + Terminal::get().print("\e[31mError\e[m: build folder no longer valid, please rebuild project.\n", true); return; } arguments = filesystem::escape_argument(filesystem::get_short_path(executable).string()); @@ -945,7 +945,7 @@ void Project::Clang::recreate_build() { } } catch(const std::exception &e) { - Terminal::get().print(std::string("Error: could not remove build: ") + e.what() + "\n", true); + Terminal::get().print(std::string("\e[31mError\e[m: could not remove build: ") + e.what() + "\n", true); return; } } @@ -974,7 +974,7 @@ void Project::Markdown::compile_and_run() { auto command = Config::get().project.markdown_command + ' ' + filesystem::escape_argument(filesystem::get_short_path(view->file_path).string()); Terminal::get().async_process(command, "", [command](int exit_status) { if(exit_status == 127) - Terminal::get().async_print("Error: executable not found: " + command + "\n", true); + Terminal::get().async_print("\e[31mError\e[m: executable not found: " + command + "\n", true); }, true); } } diff --git a/src/snippets.cpp b/src/snippets.cpp index f1f34f0..413f520 100644 --- a/src/snippets.cpp +++ b/src/snippets.cpp @@ -34,13 +34,13 @@ void Snippets::load() { if(!key_string.empty()) { gtk_accelerator_parse(key_string.c_str(), &key, &modifier); if(key == 0 && modifier == 0) - Terminal::get().async_print("Error: could not parse key string: " + key_string + "\n", true); + Terminal::get().async_print("\e[31mError\e[m: could not parse key string: " + key_string + "\n", true); } snippets.back().second.emplace_back(Snippet{snippet_it->second.get("prefix", ""), key, modifier, snippet_it->second.get("body"), snippet_it->second.get("description", "")}); } } } catch(const std::exception &e) { - Terminal::get().async_print(std::string("Error: ") + e.what() + "\n", true); + Terminal::get().async_print(std::string("\e[31mError\e[m: ") + e.what() + "\n", true); } } diff --git a/src/source.cpp b/src/source.cpp index 9934999..f7bc78e 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -317,13 +317,13 @@ Source::View::View(const boost::filesystem::path &file_path, const Glib::RefPtr< use_tmp_file = true; file_path = boost::filesystem::temp_directory_path(ec); if(ec) { - Terminal::get().print("Error: could not get temporary directory folder\n", true); + Terminal::get().print("\e[31mError\e[m: could not get temporary directory folder\n", true); return methods; } file_path /= "jucipp_get_methods" + std::to_string(get_current_process_id()); boost::filesystem::create_directory(file_path, ec); if(ec) { - Terminal::get().print("Error: could not create temporary folder\n", true); + Terminal::get().print("\e[31mError\e[m: could not create temporary folder\n", true); return methods; } file_path /= this->file_path.filename().string() + (is_cpp_standard_header ? ".hpp" : ""); @@ -411,7 +411,7 @@ bool Source::View::save() { } } catch(const Glib::Error &error) { - Terminal::get().print("Error: Could not save file " + filesystem::get_short_path(file_path).string() + ": " + error.what() + '\n', true); + Terminal::get().print("\e[31mError\e[m: Could not save file " + filesystem::get_short_path(file_path).string() + ": " + error.what() + '\n', true); return false; } @@ -942,7 +942,7 @@ void Source::View::setup_format_style(bool is_generic_view) { } } catch(const std::exception &e) { - Terminal::get().print(std::string("Error: error parsing clang-format output: ") + e.what() + '\n', true); + Terminal::get().print(std::string("\e[31mError\e[m: error parsing clang-format output: ") + e.what() + '\n', true); } get_buffer()->end_user_action(); } diff --git a/src/source_base.cpp b/src/source_base.cpp index c55c507..371c0bc 100644 --- a/src/source_base.cpp +++ b/src/source_base.cpp @@ -246,7 +246,7 @@ bool Source::BaseView::load(bool not_undoable_action) { } } catch(const Glib::Error &error) { - Terminal::get().print("Error: Could not read file " + filesystem::get_short_path(file_path).string() + ": " + error.what() + '\n', true); + Terminal::get().print("\e[31mError\e[m: Could not read file " + filesystem::get_short_path(file_path).string() + ": " + error.what() + '\n', true); return false; } } @@ -316,7 +316,7 @@ void Source::BaseView::replace_text(const std::string &new_text) { } } catch(...) { - Terminal::get().print("Error: Could not replace text in buffer\n", true); + Terminal::get().print("\e[31mError\e[m: Could not replace text in buffer\n", true); } get_buffer()->end_user_action(); @@ -1542,7 +1542,7 @@ void Source::BaseView::insert_snippet(Gtk::TextIter iter, const std::string &sni parse_snippet(false); } catch(...) { - Terminal::get().print("Error: could not parse snippet: " + snippet + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not parse snippet: " + snippet + '\n', true); return; } diff --git a/src/source_clang.cpp b/src/source_clang.cpp index fe725cd..4614239 100644 --- a/src/source_clang.cpp +++ b/src/source_clang.cpp @@ -196,7 +196,7 @@ void Source::ClangViewParse::parse_initialize() { parse_state = ParseState::stop; parse_mutex.unlock(); dispatcher.post([this] { - Terminal::get().print("Error: failed to reparse " + this->file_path.string() + ".\n", true); + Terminal::get().print("\e[31mError\e[m: failed to reparse " + this->file_path.string() + ".\n", true); status_state = ""; if(update_status_state) update_status_state(this); @@ -911,7 +911,7 @@ Source::ClangViewAutocomplete::ClangViewAutocomplete(const boost::filesystem::pa }; autocomplete.on_add_rows_error = [this] { - Terminal::get().print("Error: autocomplete failed, reparsing " + this->file_path.string() + '\n', true); + Terminal::get().print("\e[31mError\e[m: autocomplete failed, reparsing " + this->file_path.string() + '\n', true); selected_completion_string = nullptr; code_complete_results = nullptr; full_reparse(); @@ -1253,7 +1253,7 @@ Source::ClangViewRefactor::ClangViewRefactor(const boost::filesystem::path &file usages_renamed.emplace_back(&usage); } else - Terminal::get().print("Error: could not write to file " + usage.path.string() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not write to file " + usage.path.string() + '\n', true); } } diff --git a/src/source_generic.cpp b/src/source_generic.cpp index 2de0950..d893cfe 100644 --- a/src/source_generic.cpp +++ b/src/source_generic.cpp @@ -31,7 +31,7 @@ Source::GenericView::GenericView(const boost::filesystem::path &file_path, const boost::property_tree::xml_parser::read_xml(language_file.string(), pt); } catch(const std::exception &e) { - Terminal::get().print("Error: error parsing language file " + language_file.string() + ": " + e.what() + '\n', true); + Terminal::get().print("\e[31mError\e[m: error parsing language file " + language_file.string() + ": " + e.what() + '\n', true); } bool has_context_class = false; parse_language_file(has_context_class, pt); diff --git a/src/source_language_protocol.cpp b/src/source_language_protocol.cpp index 1ca288d..8180274 100644 --- a/src/source_language_protocol.cpp +++ b/src/source_language_protocol.cpp @@ -861,7 +861,7 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() { changes_renamed.emplace_back(change); } else - Terminal::get().print("Error: could not write to file " + change->file + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not write to file " + change->file + '\n', true); } for(auto &pair : changes_in_opened_files) { diff --git a/src/terminal.cpp b/src/terminal.cpp index ade5218..da2bb84 100644 --- a/src/terminal.cpp +++ b/src/terminal.cpp @@ -209,7 +209,7 @@ int Terminal::process(const std::string &command, const boost::filesystem::path process = std::make_unique(command, path.string()); if(process->get_id() <= 0) { - async_print("Error: failed to run command: " + command + "\n", true); + async_print("\e[31mError\e[m: failed to run command: " + command + "\n", true); return -1; } @@ -235,7 +235,7 @@ int Terminal::process(std::istream &stdin_stream, std::ostream &stdout_stream, c }, true); if(process.get_id() <= 0) { - async_print("Error: failed to run command: " + command + "\n", true); + async_print("\e[31mError\e[m: failed to run command: " + command + "\n", true); return -1; } @@ -282,7 +282,7 @@ std::shared_ptr Terminal::async_process(const std::stri auto pid = process->get_id(); if(pid <= 0) { - async_print("Error: failed to run command: " + command + "\n", true); + async_print("\e[31mError\e[m: failed to run command: " + command + "\n", true); if(callback) callback(-1); return process; diff --git a/src/window.cpp b/src/window.cpp index 50dadde..d0c6ce9 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -234,7 +234,7 @@ void Window::configure() { get_style_context()->add_provider_for_screen(screen, css_provider_fonts, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } catch(const Gtk::CssProviderError &e) { - Terminal::get().print("Error: could not override fonts: " + e.what() + '\n', true); + Terminal::get().print("\e[31mError\e[m: could not override fonts: " + e.what() + '\n', true); } } @@ -249,7 +249,7 @@ void Window::configure() { if(scheme) style = scheme->get_style("def:note"); else { - Terminal::get().print("Error: Could not find gtksourceview style: " + Config::get().source.style + '\n', true); + Terminal::get().print("\e[31mError\e[m: Could not find gtksourceview style: " + Config::get().source.style + '\n', true); } } auto foreground_value = style && style->property_foreground_set() ? style->property_foreground().get_value() : get_style_context()->get_color().to_string(); @@ -292,7 +292,7 @@ void Window::set_menu_actions() { if(!path.empty()) { boost::system::error_code ec; if(boost::filesystem::exists(path, ec)) { - Terminal::get().print("Error: " + path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + path.string() + " already exists.\n", true); } else { if(filesystem::write(path)) { @@ -304,7 +304,7 @@ void Window::set_menu_actions() { Terminal::get().print("New file " + path.string() + " created.\n"); } else - Terminal::get().print("Error: could not create new file " + path.string() + ".\n", true); + Terminal::get().print("\e[31mError\e[m: could not create new file " + path.string() + ".\n", true); } } }); @@ -322,7 +322,7 @@ void Window::set_menu_actions() { Terminal::get().print("New folder " + path.string() + " created.\n"); } else - Terminal::get().print("Error: " + path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + path.string() + " already exists.\n", true); Directories::get().select(path); } }); @@ -346,22 +346,22 @@ void Window::set_menu_actions() { build_config = "project('" + project_name + "', 'c')\n\nadd_project_arguments('-std=c11', '-Wall', '-Wextra', language: 'c')\n\nexecutable('" + project_name + "', 'main.c')\n"; } else { - Terminal::get().print("Error: build management system " + Config::get().project.default_build_management_system + " not supported.\n", true); + Terminal::get().print("\e[31mError\e[m: build management system " + Config::get().project.default_build_management_system + " not supported.\n", true); return; } auto c_main_path = project_path / "main.c"; auto clang_format_path = project_path / ".clang-format"; boost::system::error_code ec; if(boost::filesystem::exists(build_config_path, ec)) { - Terminal::get().print("Error: " + build_config_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + build_config_path.string() + " already exists.\n", true); return; } if(boost::filesystem::exists(c_main_path, ec)) { - Terminal::get().print("Error: " + c_main_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + c_main_path.string() + " already exists.\n", true); return; } if(boost::filesystem::exists(clang_format_path, ec)) { - Terminal::get().print("Error: " + clang_format_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + clang_format_path.string() + " already exists.\n", true); return; } std::string c_main = "#include \n\nint main() {\n printf(\"Hello World!\\n\");\n}\n"; @@ -373,7 +373,7 @@ void Window::set_menu_actions() { Terminal::get().print("C project " + project_name + " created.\n"); } else - Terminal::get().print("Error: Could not create project " + project_path.string() + "\n", true); + Terminal::get().print("\e[31mError\e[m: Could not create project " + project_path.string() + "\n", true); } }); menu.add_action("file_new_project_cpp", []() { @@ -396,22 +396,22 @@ void Window::set_menu_actions() { build_config = "project('" + project_name + "', 'cpp')\n\nadd_project_arguments('-std=c++1y', '-Wall', '-Wextra', language: 'cpp')\n\nexecutable('" + project_name + "', 'main.cpp')\n"; } else { - Terminal::get().print("Error: build management system " + Config::get().project.default_build_management_system + " not supported.\n", true); + Terminal::get().print("\e[31mError\e[m: build management system " + Config::get().project.default_build_management_system + " not supported.\n", true); return; } auto cpp_main_path = project_path / "main.cpp"; auto clang_format_path = project_path / ".clang-format"; boost::system::error_code ec; if(boost::filesystem::exists(build_config_path, ec)) { - Terminal::get().print("Error: " + build_config_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + build_config_path.string() + " already exists.\n", true); return; } if(boost::filesystem::exists(cpp_main_path, ec)) { - Terminal::get().print("Error: " + cpp_main_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + cpp_main_path.string() + " already exists.\n", true); return; } if(boost::filesystem::exists(clang_format_path, ec)) { - Terminal::get().print("Error: " + clang_format_path.string() + " already exists.\n", true); + Terminal::get().print("\e[31mError\e[m: " + clang_format_path.string() + " already exists.\n", true); return; } std::string cpp_main = "#include \n\nint main() {\n std::cout << \"Hello World!\\n\";\n}\n"; @@ -423,7 +423,7 @@ void Window::set_menu_actions() { Terminal::get().print("C++ project " + project_name + " created.\n"); } else - Terminal::get().print("Error: Could not create project " + project_path.string() + "\n", true); + Terminal::get().print("\e[31mError\e[m: Could not create project " + project_path.string() + "\n", true); } }); @@ -447,13 +447,13 @@ void Window::set_menu_actions() { if(boost::filesystem::exists(view->file_path, ec)) { std::ifstream can_read(view->file_path.string()); if(!can_read) { - Terminal::get().print("Error: could not read " + view->file_path.string() + "\n", true); + Terminal::get().print("\e[31mError\e[m: could not read " + view->file_path.string() + "\n", true); return; } can_read.close(); } else { - Terminal::get().print("Error: " + view->file_path.string() + " does not exist\n", true); + Terminal::get().print("\e[31mError\e[m: " + view->file_path.string() + " does not exist\n", true); return; }