Skip to content

Commit

Permalink
Changed: Only log tty name if known
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Sep 25, 2021
1 parent 4197f0b commit 771a200
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ int main(int argc, char **argv) {

//? Setup paths for config, log and user themes
for (const auto& env : {"XDG_CONFIG_HOME", "HOME"}) {
if (getenv(env) != NULL and access(getenv(env), W_OK) != -1) {
Config::conf_dir = fs::path(getenv(env)) / (((string)env == "HOME") ? ".config/btop" : "btop");
if (std::getenv(env) != NULL and access(std::getenv(env), W_OK) != -1) {
Config::conf_dir = fs::path(std::getenv(env)) / (((string)env == "HOME") ? ".config/btop" : "btop");
break;
}
}
Expand Down Expand Up @@ -719,8 +719,8 @@ int main(int argc, char **argv) {

//? Try to find and set a UTF-8 locale
if (bool found = false; std::setlocale(LC_ALL, NULL) == NULL or not str_to_upper(s_replace((string)std::setlocale(LC_ALL, NULL), "-", "")).ends_with("UTF8")) {
if (getenv("LANG") != NULL and str_to_upper(s_replace((string)getenv("LANG"), "-", "")).ends_with("UTF8")) {
if (std::setlocale(LC_ALL, getenv("LANG")) != NULL) {
if (std::getenv("LANG") != NULL and str_to_upper(s_replace((string)std::getenv("LANG"), "-", "")).ends_with("UTF8")) {
if (std::setlocale(LC_ALL, std::getenv("LANG")) != NULL) {
found = true;
}
}
Expand Down Expand Up @@ -758,7 +758,7 @@ int main(int argc, char **argv) {
exit(1);
}

Logger::info("Running on " + Term::current_tty);
if (Term::current_tty != "unknown") Logger::info("Running on " + Term::current_tty);
if (not Global::arg_tty and Config::getB("force_tty")) {
Config::set("tty_mode", true);
Logger::info("Forcing tty mode: setting 16 color mode and using tty friendly graph symbols");
Expand Down

0 comments on commit 771a200

Please sign in to comment.