tools: add progress implementation
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I9da1674d6cbc688efc7bab0e033788d6ee4694f7
diff --git a/tools/bt.cpp b/tools/bt.cpp
index 9e77688..d1e4dc7 100644
--- a/tools/bt.cpp
+++ b/tools/bt.cpp
@@ -16,6 +16,15 @@
return false;
}
+ std::int64_t fileSize = sys->getSize(input.c_str());
+ if (fileSize == 0)
+ {
+ std::fprintf(stderr, "Zero-length file, or other file access error\n");
+ return false;
+ }
+
+ progress->start(fileSize);
+
try
{
static constexpr int btBufferLen = 50;
@@ -33,6 +42,7 @@
&readBuffer[bytesRead]);
blob->writeBytes(session, offset, buffer);
offset += bytesRead;
+ progress->updateProgress(bytesRead);
}
} while (bytesRead > 0);
}