Skip to content

Commit

Permalink
Return copy to prevent RAII cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
eschan145 committed Jan 22, 2025
1 parent 0d9a3cf commit 817cb14
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,21 @@ DK_API void validate() {
}

uint64_t size = dyknow_size();
std::cout << "DyKnow folder size: " << comma_separated(size)
<< " bytes (" << comma_separated(size / (1024 * 1024))
<< ") " << "MBs.\n";
uint64_t size_in_mb = size / (1024 * 1024);

std::string color;
if (size_in_mb < 30) {
color = "\033[32m"; // Green
} else if (size_in_mb >= 30 && size_in_mb <= 50) {
color = "\033[0m"; // Normal (default)
} else {
color = "\033[31m"; // Red
}

std::cout << "DyKnow folder size: " << color
<< comma_separated(size) << "\033[0m" // Reset
<< " bytes (" << comma_separated(size_in_mb)
<< " MBs)\n";
}

bool exists(const char* path) {
Expand Down

0 comments on commit 817cb14

Please sign in to comment.