Skip to content

Commit

Permalink
need_comma
Browse files Browse the repository at this point in the history
  • Loading branch information
Narazaka committed Mar 21, 2024
1 parent 371dc2b commit 236030b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pngparam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ int main(int argc, char *argv[])
return 1;
}
if (json_output) printf("[\n");
bool first = true;
bool need_comma = false;
for (int i = 2 + optional_offset; i < argc; i++)
{
std::filesystem::directory_iterator root(argv[i]);
for (const auto &entry : root)
{
if (entry.path().extension() == ".png")
{
print_png_parameters(reinterpret_cast<const char *>(entry.path().u8string().c_str()), json_output && !first);
first = false;
print_png_parameters(reinterpret_cast<const char *>(entry.path().u8string().c_str()), need_comma);
need_comma = json_output;
}
}
}
Expand All @@ -168,16 +168,16 @@ int main(int argc, char *argv[])
return 1;
}
if (json_output) printf("[\n");
bool first = true;
bool need_comma = false;
for (int i = 2 + optional_offset; i < argc; i++)
{
std::filesystem::recursive_directory_iterator root(argv[i]);
for (const auto &entry : root)
{
if (entry.path().extension() == ".png")
{
print_png_parameters(reinterpret_cast<const char *>(entry.path().u8string().c_str()), json_output && !first);
first = false;
print_png_parameters(reinterpret_cast<const char *>(entry.path().u8string().c_str()), need_comma);
need_comma = json_output;
}
}
}
Expand All @@ -191,11 +191,11 @@ int main(int argc, char *argv[])
return 1;
}
if (json_output) printf("[\n");
bool first = true;
bool need_comma = false;
for (int i = 1 + optional_offset; i < argc; i++)
{
print_png_parameters(argv[i], json_output && !first);
first = false;
print_png_parameters(argv[i], need_comma);
need_comma = json_output;
}
if (json_output) printf("]\n");
}
Expand Down

0 comments on commit 236030b

Please sign in to comment.