From ee943a0821cd1e0846cf6ea52d2259374ebe02c3 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 20 Feb 2020 17:30:14 +0100 Subject: [PATCH] Make unusable path warnings their own FLOG category Fixes #6630. --- src/flog.h | 1 + src/path.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/flog.h b/src/flog.h index f85f1b647..41efc5cbd 100644 --- a/src/flog.h +++ b/src/flog.h @@ -52,6 +52,7 @@ class category_list_t { category_t debug{L"debug", L"Debugging aid (on by default)", true}; category_t warning{L"warning", L"Warnings (on by default)", true}; + category_t warning_path{L"warning-path", L"Warnings about unusable paths for config/history (on by default)", true}; category_t config{L"config", L"Finding and reading configuration"}; diff --git a/src/path.cpp b/src/path.cpp index f406f8f61..2a4b3a1ec 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -272,15 +272,15 @@ static void maybe_issue_path_warning(const wcstring &which_dir, const wcstring & FLOG(error, custom_error_msg.c_str()); if (path.empty()) { - FLOGF(error, _(L"Unable to locate the %ls directory."), which_dir.c_str()); - FLOGF(error, _(L"Please set the %ls or HOME environment variable before starting fish."), + FLOGF(warning_path, _(L"Unable to locate the %ls directory."), which_dir.c_str()); + FLOGF(warning_path, _(L"Please set the %ls or HOME environment variable before starting fish."), xdg_var.c_str()); } else { const wchar_t *env_var = using_xdg ? xdg_var.c_str() : L"HOME"; - FLOGF(error, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."), + FLOGF(warning_path, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."), which_dir.c_str(), env_var, path.c_str()); - FLOGF(error, _(L"The error was '%s'."), std::strerror(saved_errno)); - FLOGF(error, _(L"Please set $%ls to a directory where you have write access."), env_var); + FLOGF(warning_path, _(L"The error was '%s'."), std::strerror(saved_errno)); + FLOGF(warning_path, _(L"Please set $%ls to a directory where you have write access."), env_var); } ignore_result(write(STDERR_FILENO, "\n", 1)); }