Skip to content

Commit

Permalink
Write newline at end of config file
Browse files Browse the repository at this point in the history
  • Loading branch information
planet36 committed Jan 31, 2024
1 parent edcb68c commit 6936348
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/btop_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,17 @@ namespace Config {
if (geteuid() != Global::real_uid and seteuid(Global::real_uid) != 0) return;
std::ofstream cwrite(conf_file, std::ios::trunc);
if (cwrite.good()) {
cwrite << "#? Config file for btop v. " << Global::Version;
cwrite << "#? Config file for btop v. " << Global::Version << "\n";
for (auto [name, description] : descriptions) {
cwrite << "\n\n" << (description.empty() ? "" : description + "\n")
cwrite << "\n" << (description.empty() ? "" : description + "\n")
<< name << " = ";
if (strings.contains(name))
cwrite << "\"" << strings.at(name) << "\"";
else if (ints.contains(name))
cwrite << ints.at(name);
else if (bools.contains(name))
cwrite << (bools.at(name) ? "True" : "False");
cwrite << "\n";
}
}
}
Expand Down

0 comments on commit 6936348

Please sign in to comment.