Make unusable path warnings their own FLOG category

Fixes #6630.
This commit is contained in:
Fabian Homborg 2020-02-20 17:30:14 +01:00
parent 05b8d4de97
commit ee943a0821
2 changed files with 6 additions and 5 deletions

View file

@ -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"};

View file

@ -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));
}