Fixed the file implementations, they weren't using a mode, and the base path was always set to /tmp/.

We now get the systems idea of where the users download folder is and use that as the base path when receiving a file.

PiperOrigin-RevId: 406406731
This commit is contained in:
jfcarroll
2021-10-29 11:46:22 -07:00
committed by Copybara-Service
parent acf516189b
commit 44fad7d8fb
7 changed files with 57 additions and 17 deletions
+3 -2
View File
@@ -27,7 +27,7 @@ namespace shared {
// InputFile
InputFile::InputFile(const std::string& path, std::int64_t size)
: file_(path), path_(path), total_size_(size) {}
: file_(path, std::ios::binary), path_(path), total_size_(size) {}
ExceptionOr<ByteArray> InputFile::Read(std::int64_t size) {
if (!file_.is_open()) {
@@ -62,7 +62,8 @@ Exception InputFile::Close() {
// OutputFile
OutputFile::OutputFile(absl::string_view path) : file_(std::string(path)) {}
OutputFile::OutputFile(absl::string_view path)
: file_(std::string(path), std::ios::binary) {}
Exception OutputFile::Write(const ByteArray& data) {
if (!file_.is_open()) {