Print every file exported with `PCKPacker.flush()`s verbose parameter

Previously, only one line per 100 files was printed.

This also refactors the print statement to use Godot methods and
make it more informative overall.

(cherry picked from commit 8e57e5dc6a)
This commit is contained in:
Hugo Locurcio 2022-02-25 02:32:20 +01:00 committed by Rémi Verschelde
parent e66003b09a
commit 824eaabd7b
1 changed files with 5 additions and 7 deletions

View File

@ -154,13 +154,11 @@ Error PCKPacker::flush(bool p_verbose) {
src->close(); src->close();
memdelete(src); memdelete(src);
count += 1; count += 1;
if (p_verbose && files.size() > 0) { const int file_num = files.size();
if (count % 100 == 0) { if (p_verbose && (file_num > 0)) {
printf("%i/%i (%.2f)\r", count, files.size(), float(count) / files.size() * 100); print_line(vformat("[%d/%d - %d%%] PCKPacker flush: %s -> %s", count, file_num, float(count) / file_num * 100, files[i].src_path, files[i].path));
fflush(stdout); }
}; }
};
};
if (p_verbose) { if (p_verbose) {
printf("\n"); printf("\n");